|
-
Nov 12th, 2002, 04:48 PM
#1
Thread Starter
Hyperactive Member
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
-
Nov 12th, 2002, 04:52 PM
#2
Member
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.
-
Nov 12th, 2002, 04:58 PM
#3
Thread Starter
Hyperactive Member
Thanks for the reply.
I tried that , not work neither.
-
Nov 12th, 2002, 05:36 PM
#4
So what is the problem? Are you getting an error? If so which one?
-
Nov 12th, 2002, 05:36 PM
#5
Ahh nevermind I just spotted webform. Set the AutoPostBack on the combo to True.
-
Nov 12th, 2002, 11:08 PM
#6
PowerPoster
Or instead of this:
Label5.Text = combProduct.SelectedIndex
do this:
Label5.Text = combProduct.Text
-
Nov 13th, 2002, 12:31 AM
#7
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|