Solved

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

Posted on 2006-11-01
4
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 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