To access public members of the class, you must create its object. The object can be created by using the New keyword.
Dim stu As New Student
Accessing a class’s public members through objects
To access public members of a class, you must write its name of object followed by dot sign(.) and the names of its members.
Dim st As New Student 'create object
st.setnumber()' accessing members
Private stnumber As Integer
Private stname As String
Private stsex As String
Public Sub setnumber()
Console.WriteLine("Enter student's number:")
stnumber = CInt(Console.ReadLine)
Public Sub getnumber()
Console.WriteLine("Student's number is:" & stnumber)
This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages: