Solved

VB.Net "Interface" error, not sure what's missing

Posted on 2006-11-01
4
391 Views
Last Modified: 2008-02-01
This code works fine in C#:
http://aspalliance.com/837_Implementing_a_Data_Access_Layer_in_C

I copied and pasted it here to convet it to VB.Net:
http://www.developerfusion.co.uk/utilities/convertcsharptovb.aspx

I took the entire VB.Net code, and copied it to a class (this is asp.net 2.0, WAP)...

 I get this error ( Blue line under "Implements IDBManager" )saying to implement each function in IDBManager. I have no clue what I'm missing...
This is a simplified code:


Namespace DataAccessLayer

    Public Interface IDBManager
      ...
    Sub Open()
End Interface
End Namespace

Namespace DataAccessLayer

    Public NotInheritable Class DBManager
        Implements IDBManager  '[b] blue error line under IDBManager [/b]

      Public Sub Open()
            idbConnection = DBManagerFactory.GetConnection(Me.providerType)
            idbConnection.ConnectionString = Me.ConnectionString
            If Not (idbConnection.State = ConnectionState.Open) Then
                idbConnection.Open()
            End If
            Me.idbCommand = DBManagerFactory.GetCommand(Me.providerType)
        End Sub

End Class
End Namespace
   



[b] error is : Class 'DBManager' must implement 'Sub Open()' for interface 'IDBManager' [/b]
any ideas?
0
Comment
Question by:Camillia
  • 2
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 17853074
The interface requires all its elements (procs/funcs/props etc) in IDBManager to be in your source.
I think one (or more) of these is missing. There are alot there so you'll need to check.
But basically all procs/funcs/props etc need to be in the DBManager class you implemented the Interface IDBManager.
0
 
LVL 7

Author Comment

by:Camillia
ID: 17853128
I commented out everything in IDBManager except for "Sub Open()".

Then in DBManager, I do see :
 Public Sub Open()
            idbConnection = DBManagerFactory.GetConnection(Me.providerType)
            idbConnection.ConnectionString = Me.ConnectionString
            If Not (idbConnection.State = ConnectionState.Open) Then
                idbConnection.Open()
            End If
            Me.idbCommand = DBManagerFactory.GetCommand(Me.providerType)
        End Sub

But I get an error that "Sub Open" must be implmeneted. I am implementing it!!!
0
 
LVL 10

Accepted Solution

by:
Kinger247 earned 500 total points
ID: 17853182
That line should be :

Public Sub Open() Implements IDBManager.Open

0
 
LVL 7

Author Comment

by:Camillia
ID: 17853196
Ah, yes. Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now