is it posible to insert an item in list box to textbox?
i have a listbox and i want to insert the selected item in my textbox.. but when i click the listbox.. i recieve an error.. please help me.. this is my code..
VB Code:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Label1.Text = ListBox1.Items(ListBox1.SelectedItem.Text).Text
End Sub
Re: is it posible to insert an item in list box to textbox?
if you want the text of the selected item then just use:
VB Code:
Textbox1.text = ListBox1.SelectedItem.Text
if you want the value use:
VB Code:
TextBox1.Text = ListBox1.SelectedValue.ToString
Re: is it posible to insert an item in list box to textbox?
I think ListBox1.SelectedValue is already a string, so no need for .ToString
Woka