Click here to Skip to main content
16,012,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one usercontrol with some controls like combobox , textbox , lables .. etc
now i am using this user control on my winform .

i just want to get the combobox events on my main page where i put the usercontrol.

please suggest a way to do that.
Posted

Unless the user control exposes those events (or exposed the combo box itself, which is a very bad idea) you can't.

That's the whole idea! The internals of a user control are intended to be hidden from the user, and only those priories that the control explicitly exposes are available to code using the control.

You will have to modify the control source to add events which are "passed through" from the combo box to the "outside world".
 
Share this answer
 
changes in user control :-

Public Event tbClick() 'As EventHandler

Private Sub cboPaymentOptions_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboPaymentOptions.SelectedIndexChanged
RaiseEvent tbClick()
End Sub


changes in main form :-
'addeded on page load
AddHandler ucPayement.tbClick, AddressOf myfunction

'create a function with name myfunction

public sub myfunction
'do something
end sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900