Hi. I really need help on how to use a value stored in a listbox.
I have a form on which it has the following code. This form allows the user to add a value to the textbox which is on this page and then takes the user to the next page:
Public Class City
Dim frm1 As ConfirmDestinat ion 'Our instance of form2
Dim items As New List(Of String) 'Internal collection of items
Dim streetitem As New List(Of String) 'Internal collection of items
Dim postcodeitem As New List(Of String) 'Internal collection of items
Private Sub Button23_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Button23.Click
Dim newItem As String = TextBox1.Text
items.Add(newIt em) 'Add new item to our list
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox2.I tems.Add(newIte m)
TextBox1.Text = ""
If frm1 Is Nothing OrElse frm1.IsDisposed Then
frm1 = New ConfirmDestinat ion
frm1.ListBox2.I tems.AddRange(i tems.ToArray)
frm1.Show()
Else
frm1.Visible = True
End If
If newItem = "OSTERLEY" Then
Dim Item1 As String = "ST MARY'S CRESCENT"
streetitem.Add( Item1) 'Add new item to our list
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox1.I tems.Add(Item1)
End If
If newItem = "OSTERLEY" Then
Dim Item2 As String = "TW74NB"
postcodeitem.Ad d(Item2)
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox3.I tems.Add(Item2)
End If
End Sub
Once the user has clicked the NEXT button to go to the next form, there are three listboxes. i want to be able to go through the listbox values and say the following:
if listbox1 contains ST MARY'S CRESCENT and listbox2 contains OSTERLEY and listbox3 contains TW74NB, then display form A
HOW do i do this?? Please help!
I have a form on which it has the following code. This form allows the user to add a value to the textbox which is on this page and then takes the user to the next page:
Public Class City
Dim frm1 As ConfirmDestinat ion 'Our instance of form2
Dim items As New List(Of String) 'Internal collection of items
Dim streetitem As New List(Of String) 'Internal collection of items
Dim postcodeitem As New List(Of String) 'Internal collection of items
Private Sub Button23_Click( ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Button23.Click
Dim newItem As String = TextBox1.Text
items.Add(newIt em) 'Add new item to our list
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox2.I tems.Add(newIte m)
TextBox1.Text = ""
If frm1 Is Nothing OrElse frm1.IsDisposed Then
frm1 = New ConfirmDestinat ion
frm1.ListBox2.I tems.AddRange(i tems.ToArray)
frm1.Show()
Else
frm1.Visible = True
End If
If newItem = "OSTERLEY" Then
Dim Item1 As String = "ST MARY'S CRESCENT"
streetitem.Add( Item1) 'Add new item to our list
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox1.I tems.Add(Item1)
End If
If newItem = "OSTERLEY" Then
Dim Item2 As String = "TW74NB"
postcodeitem.Ad d(Item2)
'If Form2 exists then add the item to it's listbox
If frm1 IsNot Nothing AndAlso Not frm1.IsDisposed Then frm1.ListBox3.I tems.Add(Item2)
End If
End Sub
Once the user has clicked the NEXT button to go to the next form, there are three listboxes. i want to be able to go through the listbox values and say the following:
if listbox1 contains ST MARY'S CRESCENT and listbox2 contains OSTERLEY and listbox3 contains TW74NB, then display form A
HOW do i do this?? Please help!