Detecting a change in a drop-down

garcon

Well-known member
Joined
Dec 13, 2004
Messages
47
Programming Experience
Beginner
Hi everyone,

I'm trying to detect when a user selects an option in a drop-down menu list. I'm using the following code in the code-behind file:

VB.NET:
Sub dllFxCurrency_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddlFxCurrency.Init

currencyChoice = ddlFxCurrency.SelectedIndex

End Sub

Unfortunately it only detects the initial value. It does not detect ant changes and it is the changes or the new selected value that I am interested in.

Can anyone please help?
Thanks you,
G.
 
drop-down menu list? You mean a combobox or a main menu/contextmenu? For a combobox use .SelectedIndexChanged

TPM
 
Its a "System.Web.UI.HTMLControls.HTMLSelect" - using the toolbox in the HTML section I added a drop down list box.

Thing is though - my system is not allowing me to use SelectedIndexChanged

It's saying: Event SelectedIndexchanged cannot be found.

I'm really annoyed. Will I have to delete the HTML drop down and insert another Web Form type one?

Confused,
G.
 
AH I see, you should have posted this under asp.net, not vb.net.

Why did you use the html drop down list box? You should still be able to get it to work (Check the selected index in you form_onload), but the webform dropdownlist will be a lot easyer, as that'll allow you to use SelectedIndexChanged.

TPM
 
Back
Top