Results 1 to 7 of 7

Thread: combbox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    combbox

    hi,
    I have a label and a combbox on my web form.
    what I want to do is after I change the comb's selection, the lable displays the comb's SelectedIndex. It is so simple, but I just can not make it work. Can somebody help? thanks.

    The following is my code:

    Private Sub combProduct_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles combProduct.SelectedIndexChanged

    Label5.Text = combProduct.SelectedIndex

    End Sub

  2. #2
    Member
    Join Date
    Dec 2001
    Location
    Chicago, IL
    Posts
    49
    if its throwing you an error, you probably need..

    label5.text = combproduct.selectedindex.tostring

    you should probably put .tostring there anyway seeing as your going from an int to a string.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    Question

    Thanks for the reply.
    I tried that , not work neither.

  4. #4
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    So what is the problem? Are you getting an error? If so which one?

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Ahh nevermind I just spotted webform. Set the AutoPostBack on the combo to True.

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Or instead of this:
    Label5.Text = combProduct.SelectedIndex
    do this:
    Label5.Text = combProduct.Text

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    But still if the postback is not set then the event doesn't fire until the next time the page is loaded.

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