Results 1 to 3 of 3

Thread: Adding values to a listbox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Adding values to a listbox

    I want to add values to the items in a listbox.

    I add the items on page_load:

    lstbox.items.add(someItem)

    Is there a way to add a value for that item?

    So for an item it would display 'Some Guy' but the selected value would be his ID number like 1.

    Thanks again.

  2. #2
    Addicted Member rdove's Avatar
    Join Date
    Dec 2002
    Location
    Indianapolis
    Posts
    251

    Re: Adding values to a listbox

    This should do it for you:

    VB Code:
    1. Dim liAdd As ListItem
    2.  
    3. liAdd = New ListItem
    4.  
    5. liAdd.Text = "Some Guy"
    6. liAdd.Value = "1"
    7.  
    8. lstbox.Items.Add(liAdd)
    ~Ryan





    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2004
    Posts
    149

    Re: Adding values to a listbox

    Beauty, thanks again for your help.

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