stu nicholls dot com | menu - Professional dropdown #3



Reference Types and Value Types

Examples of value type: Examples of reference type:
Public Class Form1
Dim myform As System.Windows.Forms.Form
Private Sub Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Dim x, y As New System.Windows.Forms.Form()
x.Text = "This is form 1"
MessageBox.Show(x.Text)
y = x
MessageBox.Show(y.Text)
y.Text = "This is form 2"
MessageBox.Show(y.Text)
a = New class1()
a.strn = "hello object a"
MessageBox.Show(a.strn)
myform = New System.Windows.Forms.Form()
myform.Text = "Hello myform"
MessageBox.Show(myform.Text)
Dim m, n As Integer
m = 15
MessageBox.Show(m)
n = m
MessageBox.Show(n)
m = 25
MessageBox.Show(m)
End Sub
Public a As class1
Public Class class1
Public strn As String
End Class

<< Previous


comments powered by Disqus
click here
Footer1