Simple example of using classes in vb.net
Account Home | Help | Blog | Contact us | Log Out


Welcome to Kbytes > Articles

Simple example of using classes in vb.net

Posted By: siteadmin on 18/03/2013 10:55:00

 

In form1.vb you need to add this code:
 
 
Public Class Form1
 
    Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 
        Dim test As Example = New Example()
        ' Set property.
        test.Number = 13234
        ' Get property.
        Debug.Print(test.Number)
    End Sub
End Class
 
 
Then in the Class file you can store this:
 
Class Example
    Private storedValue As Integer
 
    Public Property Number() As Integer
        Get
            Return storedValue
        End Get
        Set(ByVal value As Integer)
            storedValue = value
        End Set
    End Property
End Class
 
This allows you to set and get the stored value (Number)
 

blog comments powered by Disqus

Kbytes Home | Privacy Policy | Contact us | Testing Area

© 2004 - 2018 1 Oak Hill Grove Surbiton Surrey KT6 6DS Phone: +44(020)82617371