Currymunch
Member
- Joined
- Jan 21, 2008
- Messages
- 13
- Programming Experience
- Beginner
Beginner Help
Hello all - I am trying to use a ListBox in order to display information about a class that i have created, when I click the Add spy button - a form appears that allows values to be entered, this information corresponds to the properties of the class. I would then like to add the item to the ListBox
'****************************************
Private Sub cmdConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConfirm.Click
If Me.Text = "Add Spy" Then
Dim thisSpy As New CSpy
thisSpy = New CSpy
thisSpy.FirstName = txtFirstName.Text
thisSpy.Surname = txtSurname.Text
thisSpy.CodeName = txtCodeName.Text
thisSpy.Age = comboAge.Text
thisSpy.Sex = comboSex.Text
thisSpy.DMarks = txtDmarks.Text
thisSpy.Skills = txtSkills.Text
thisSpy.BankNo = txtBankNumber.Text
mainSpy1.lblCurrentSpy.Text = thisSpy.FirstName + thisSpy.Surname + _
thisSpy.CodeName + CStr(thisSpy.Age) + thisSpy.Sex + thisSpy.DMarks + _
thisSpy.Skills + CStr(thisSpy.BankNo)
mainSpy1.spyList.Items.Add(thisSpy)
Else
End If
End Sub
'*****************************************************
I'm just setting it up so im not worried about the formatting at the moment I just want to add it to the ArrayList
This is what I get with the code thus far

I am looking to get the labels values into the ListBox. Any pointers would be greatly apprieciated.
Thanks in advance.
Hello all - I am trying to use a ListBox in order to display information about a class that i have created, when I click the Add spy button - a form appears that allows values to be entered, this information corresponds to the properties of the class. I would then like to add the item to the ListBox
'****************************************
Private Sub cmdConfirm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdConfirm.Click
If Me.Text = "Add Spy" Then
Dim thisSpy As New CSpy
thisSpy = New CSpy
thisSpy.FirstName = txtFirstName.Text
thisSpy.Surname = txtSurname.Text
thisSpy.CodeName = txtCodeName.Text
thisSpy.Age = comboAge.Text
thisSpy.Sex = comboSex.Text
thisSpy.DMarks = txtDmarks.Text
thisSpy.Skills = txtSkills.Text
thisSpy.BankNo = txtBankNumber.Text
mainSpy1.lblCurrentSpy.Text = thisSpy.FirstName + thisSpy.Surname + _
thisSpy.CodeName + CStr(thisSpy.Age) + thisSpy.Sex + thisSpy.DMarks + _
thisSpy.Skills + CStr(thisSpy.BankNo)
mainSpy1.spyList.Items.Add(thisSpy)
Else
End If
End Sub
'*****************************************************
I'm just setting it up so im not worried about the formatting at the moment I just want to add it to the ArrayList
This is what I get with the code thus far

I am looking to get the labels values into the ListBox. Any pointers would be greatly apprieciated.
Thanks in advance.
Last edited by a moderator: