Results 1 to 3 of 3

Thread: is it posible to insert an item in list box to textbox?

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2005
    Location
    Philippines
    Posts
    32

    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:
    1. Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    2.         Label1.Text = ListBox1.Items(ListBox1.SelectedItem.Text).Text
    3.     End Sub

  2. #2
    Member basilisk's Avatar
    Join Date
    Jan 2002
    Posts
    32

    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:
    1. Textbox1.text = ListBox1.SelectedItem.Text

    if you want the value use:
    VB Code:
    1. TextBox1.Text = ListBox1.SelectedValue.ToString

  3. #3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width