Question

It seems like a straight forward thing, but I can't figure it out.

How can I check if a certain button was clicked from user control?

my user control is uc_test and button name is btnTest .

I assume its some sort of event handler added to uc_test.btnTest ?

I'm working in WinForms.

Was it helpful?

Solution

It sounds like you've created a button but want to make it do something on click. I don't often use Winforms but from memory double-clicking on the control in the form should automatically create a btnTest_Click method. If not, just go to code and put in a method like:

protected void btnTest_Click(object sender, Eventargs e)
{
   //do something
}

Then set in the properties of the button the OnClick event to btnTest_Click.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top