PDA

View Full Version : Listbox Event Handling Problem


LiLo
02-20-2006, 10:48 AM
Hi,
I am creating a web parts control containing a listbox, a button and a context menu using visual basic.net. I have created both controls and would like to add a selectionIndexChanged event handler for the listbox but the intellisense list did not display the listbox control.

Here is a code snippet:

Protected Overrides Sub CreateChildControls()

listbox1 = new listbox //adding a listbox control
listbox1.ID = "List1"
listitem1.Text = "Testing"
listbox1.Items.Add(listitem1)
Me.Controls.Add(listbox1)
//intellisense didnt display the listbox for event handling! [?]:confused:

button1 = new button //adding a button control
button1.ID = "Button1"
button1.Text = "Test"
Me.Controls.Add(button1)
AddHandler button1.Click, AddressOf button1_Click //intellisense did include the button control for event handling

End Sub

How do I allow event handling for the listbox? It seems that vb was unable to recognise the listbox for AddHandler :mad: