Elahe
Elahe

Reputation: 1399

press enter key and user control event happen

I have a userControl(DT_Navigator). there is a button (btnNew) in it. I wrote the click button event for it:

public void btnNew_Click(object sender, EventArgs e)
{
        btnNew.Enabled = false;
}

I use the user control button in another project and wrote another click event for it:

public void btnNew_Click(object sender, EventArgs e)
{
        btnNew.Enabled = false;
}

but, when I press the Enter key, just the first event that I defined in user control, executes. However I want both events to execute.

when I click on btnNew, both events trigger, but when I press Enter key, only one event triggers.

how can I fix the problem? Thanks...

Upvotes: 0

Views: 738

Answers (1)

Darj
Darj

Reputation: 1403

Try this:

DT_Navigator.btnNew.Click += new EventHandler(DTnewItem);

Upvotes: 1

Related Questions