Posted by: Sourav | September 4, 2016

Override tostring in vb,VB Teacher Sourav,Kolkata 09748184075

Option Strict On
Option Explicit On
Imports System

Module Module1

Sub Main()
Dim s1 As sample = New sample
s1.manipulatefirstname = “Sourav”
s1.manipulatelastname = “Bhattacharya”

End Sub

End Module
Public Class sample
Private firstname As String
Private lastname As String
Public Property manipulatefirstname() As String
Return Me.firstname
End Get

Set(ByVal firstname As String)
Me.firstname = firstname

End Set
End Property
Public Property manipulatelastname() As String
Return Me.lastname
End Get

Set(ByVal lastname As String)
Me.lastname = lastname

End Set
End Property
Public Overrides Function ToString() As String
Return Me.firstname+” “+Me.lastname

End Function
End Class


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: