HighTechTalks DotNet Forums  

Implement a VB interface.

VB.net microsoft.public.dotnet.languages.vb


Discuss Implement a VB interface. in the VB.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mr. X.
 
Posts: n/a

Default Implement a VB interface. - 01-25-2010 , 09:54 AM






Hello.
What is the equivalent code in VB (As the following C# code) ?

public interface myInterface : UpInterface
{
}
....

How can I implement the UpInterface in VB.NET ?

Need sample code, please.

Thanks

Reply With Quote
  #2  
Old   
Armin Zingler
 
Posts: n/a

Default Re: Implement a VB interface. - 01-25-2010 , 10:13 AM






Mr. X. schrieb:
Quote:
Hello.
What is the equivalent code in VB (As the following C# code) ?

public interface myInterface : UpInterface
{
}
....

How can I implement the UpInterface in VB.NET ?

Need sample code, please.

Thanks
RTFM

--
Armin

Reply With Quote
  #3  
Old   
Captain Jack
 
Posts: n/a

Default Re: Implement a VB interface. - 01-25-2010 , 10:15 AM



"Mr. X." <nospam (AT) nospam_please (DOT) com> wrote

Quote:
Hello.
What is the equivalent code in VB (As the following C# code) ?

public interface myInterface : UpInterface
{
}
...

How can I implement the UpInterface in VB.NET ?

Need sample code, please.

Thanks

Generic examples:

-------------------------------------------------------------------------------
' Declare an interface
Public Interface Interface1
Sub Message(ByVal Text As String)
End Interface

' Declare a class that implements the interface
Public Class Class1
Implements Interface1

Public Sub Message(ByVal Text As String) Implements Interface1.Message
' Do some stuff here
End Sub
End Class

' Declare an interface that inherits from another interface
Public Interface Interface2
Inherits Interface1
Property MsgType() As Integer
End Interface

' Declare a class that implements the complex interface
Public Class Class2
Implements Interface2

Public Sub Message(ByVal Text As String) Implements Interface1.Message
' Do stuff here
End Sub

Public Property MsgType() As Integer Implements Interface2.MsgType
Get
' Return something here
End Get
Set(ByVal value As Integer)
' Set a value here
End Set
End Property
End Class
-------------------------------------------------------------------------------

--
Jack

Reply With Quote
  #4  
Old   
Armin Zingler
 
Posts: n/a

Default Re: Implement a VB interface. - 01-25-2010 , 10:16 AM



I feel so sorry that I didn't search for you in my previous reply.

Here it is:
http://msdn.microsoft.com/en-us/library/28e2e18x.aspx

Same available via [F1] key.

--
Armin

Reply With Quote
  #5  
Old   
Family Tree Mike
 
Posts: n/a

Default RE: Implement a VB interface. - 01-25-2010 , 11:00 AM



"Mr. X." wrote:

Quote:
Hello.
What is the equivalent code in VB (As the following C# code) ?

public interface myInterface : UpInterface
{
}
....

How can I implement the UpInterface in VB.NET ?

Need sample code, please.

Thanks


.

The equivalent is:

Public Interface myInterface
Inherits UpInterface
End Interface

I'm not sure what the "UpInterface" is, but to impliment it, just create a
class as below:

Public Class MyUpper
Implements myInterface ' or UpInterface...
End Class

When you type the Impliments statement, the IDE adds the stubbed
functions/properties for you.

Mike

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.