Trying to return a selected listbox item to another form .tried lots of
ways; defining public variables and passing those as well as textboxes ..I'
m able to display the chosen item on it's form in a textbox and I'm able to
pass other variables to the 2nd form, but not the data I want . I should add
this is a smartdeviceapplication(if that matters; not sure)
Here's most of the test code .
(for form 1)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ListBox1.Items.Add("audi")
ListBox1.Items.Add("buick")
ListBox1.Items.Add("chevy")
ListBox1.Items.Add("ford")
End Sub
Public curitem As String
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
' Dim curItem As String = ListBox1.SelectedItem.ToString()
'Friend curItem As String
curItem = ListBox1.SelectedItem
TextBox1.Text = curItem
vcar = curItem
End Sub
Public Property vcar() As String ' nothing comes back from this
Get
Return ListBox1.SelectedItem
'return vcar
'return curitem
End Get
Set(ByVal Value As String)
'TextBox1.Text = Value
End Set
End Property
Public Property vn() As String 'this retuns "textbox1"
Get
Return TextBox1.Text
End Get
Set(ByVal Value As String)
TextBox1.Text = Value
End Set
End Property
Public Property t() As String 'this works
Get
Return "test"
End Get
Set(ByVal Value As String)
End Set
End Property
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Dim f2 As Form2
f2 = New Form2
f2.Show()
End Sub
On form2 I've got
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Text = f1.vcar
TextBox2.Text = f1.vn
TextBox3.Text = f1.t
End Sub