How to work with an interface in VB.NET?
The following code demonstrates the ability to work with an interface. An interface defines a method's name and not it's contents.
Imports System
Imports Microsoft.VisualBasic
Public Interface NewInt
Sub Mysub()
Function MyFun() As String
End Interface
Class myclass Implements MyInt
' Implementing the above defined interface, need to use the keyword implements to use the interface
Shared Sub Main()
Dim mc As New myclass()
mc.Mysub()
End Sub
Sub Mysub() Implements NewInt.Mysub
MsgBox("Hello from INterfaces")
End Sub
Function MyFun() As String Implements NewInt.MyFun
dim str as string
str="hello matey"
return (str)
End Function
End Class
Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com
Index
Sponsored links
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
Add complete SSH and SFTP support to your .NET framework application
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
