In ASP.NET, you can use onselectedindexchanged
event, similar to the SelectedIndexChanged
of winforms:
<asp:DropDownList ID="ddl1" runat="server" AutoPostBack="True"
onselectedindexchanged="myFunction">
</asp:DropDownList>
In your code behind:
Protected Sub ddl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl1.SelectedIndexChanged
'Your logic here
End Sub
Update:
In winforms, you can use SelectedIndexChanged
, but I suggest SelectionChangeCommitted
event in order to fire the event if the user is really the one who changed the selections.
Private Sub ComboBox1_SelectionChangeCommitted(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectionChangeCommitted
'Your code goes here...
End Sub