Results 1 to 3 of 3

Thread: Selecting Listbox Item Based On Textbox.Text Value - MORE INFO

  1. #1

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Question Selecting Listbox Item Based On Textbox.Text Value - MORE INFO

    Anybody have any idea how to select a listbox item to equal the text value in a textbox? My aim is to already have the Customer selected in the ListBox when they go to the next tab. I'm thinking maybe this needs to be done in a TabIndexChanged event or something.

    I've tried :

    VB Code:
    1. lbxRecCust.SelectedItem.Item(0)=txtCustomerName.Text
    2.  
    3. lbxRecCust.SelectedValue = txtCustomerName.Text
    4.  
    5. lbxRecCust.SelectedIndex=txtCustomerName.Text
    And a couple of others...not sure how to handle this here.

    MORE INFO - When I used the first option, it does not select the item, and when I manually select an item, I get an error that highlights my sql statement that fills in the partnumber listbox (from yesterday's discussion), and gives me a System.NullReferenceException (object reference not set...)
    Last edited by milkmood; Jun 17th, 2005 at 11:43 AM.
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

  2. #2
    Lively Member
    Join Date
    Jun 2004
    Posts
    99

    Re: Selecting Listbox Item Based On Textbox.Text Value - MORE INFO

    It seems like your second option should work. If you are using a dataset, do you have the ValueMember property of the listbox set?

  3. #3

    Thread Starter
    Lively Member milkmood's Avatar
    Join Date
    Mar 2005
    Location
    Forests of Delta Halo
    Posts
    109

    Re: Selecting Listbox Item Based On Textbox.Text Value - MORE INFO

    I am not using a ValueMember property. There are none available. I'm doing all the db stuff manually.
    When I say 'jump', don't waste time asking 'how high?'.

    Just a poor, dumb wanna-be programmer.

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