I created a simple Class called Student.
And then I tried to create an array of Students called s. I'd like to do something simple with the names of one of the students like the following...Code:Public Class Student Property FirstName As String = "" Property LastName As String = "" End Class
I know that I need to use the New keyword to create an instance for each s(), but I'm not sure where to put it. When I try it without the array it's easy.Code:Public Class frmMain Public s(0 To 10) As Student Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load s(1).FirstName = "Joe" s(1).LastName = "Mama" End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox(s(1).FirstName & "'s last name is " & s(1).LastName) End Sub End Class
But the array of students changes things.Code:Dim s As New Student




Reply With Quote