archer_coal
Well-known member
- Joined
- Apr 4, 2003
- Messages
- 96
i have a dataset populating my listbox like so:
in a Doubleclick event of the listbox, i would like to populate a text box with the corrosponding data of the list box.
Sounds like it should be simple but i keep getting errors telling me i cant convert to string.
ive also tried a .gettype.tostring with no success but maybe i wasnt doing it correctly.
any ideas?
Code:
Public Function bind_listbox(ByVal str_column As String)
Make the data adapter.
m_DataAdapter = New OleDbDataAdapter( _
"SELECT * FROM " & str_column & " order by id", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\data\20304aa1.mdb")
Fill the DataSet.
m_DataAdapter.Fill(m_DataSet)
ListBox1.DataSource = m_DataSet.Tables(0)
ListBox1.DisplayMember = "1"
End Function
in a Doubleclick event of the listbox, i would like to populate a text box with the corrosponding data of the list box.
Sounds like it should be simple but i keep getting errors telling me i cant convert to string.
Code:
Private Sub Listbox1_doubleclick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
Dim str As String
str = ListBox1.SelectedItem
TextBox1.Text = str
End Sub
ive also tried a .gettype.tostring with no success but maybe i wasnt doing it correctly.
any ideas?