Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a usercontrol problem

Status
Not open for further replies.

chenshch

Technical User
Jun 9, 2004
8
CN
hello
i have written a usercontrol which contains a listbox,
and i use it in a winApp.
i want the listbox to recieve some mouse_event,
and handle these mouse_event,but i canot write the
eventhandle funtion in the usercontrol,i want to write
it in the winApp.How to handle this problem?

waiting help
 
i think there's no reason why you shouldn;'t be able to declare a public event of your user control that can be consumed from the hosting form and that can be 'raised' from inside an event of the user control

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Change the Modifier property of the listbox control to a type other than private, like internal or public. That way you can derefence listbox's members anywhere in your winapp.

Code:
userControl1.listBox1.Click += new System.EventHandler(object sender, EventArgs e)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top