dim objCoun as new listbox
objCoun.id = "lbxCountries"
objCoun.Rows = "1"
objCoun.DataTextField = "Country_Name"
objCoun.DataValueField = "Country_Id"
But when I try to set the event
objCoun.OnSelectedIndexChanged="tro"
This is the error message:
Compiler Error Message: BC30390: 'System.Web.UI.WebControls.ListControl.Protected Overridable Sub OnSelectedIndexChanged(e As System.EventArgs)' is not accessible in this context because it is 'Protected'.
Source Error:
Line 44: objCoun.DataTextField = "Country_Name"
Line 45: objCoun.DataValueField = "Country_Id"
Line 46: objCoun.OnSelectedIndexChanged = "tro"
Line 47: objCoun.DataSource=dbread
Line 48: objCoun.DataBind()
How can I set the event in runtime?
Thanks for your helpTry:
AddHandler objCoun.SelectedIndexChanged, AddressOf tro
...assuming tro is the name of your event handler with the appropriate signature:
Private Sub tro(ByVal sender As System.Object, ByVal e As System.EventArgs)
"tro" is the subroutine name. That means when the objCoun changes its index then the action is sent to "tro"
0 comments:
Post a Comment