Solved

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

Posted on 2006-11-01
4
397 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

12 Experts available now in Live!

Get 1:1 Help Now