|
-
December 17th, 2002, 04:48 AM
#1
Add EventHandler
Hi all!
I'm a begginer in C#.
I want to know how add events on control, for exaple:
I have DataGrid and i want add event OnDoubleClick().
Is there wizard like in Visual Studio 6.
I add on hands
this.datagrid.DoubleClick+= new System.EventHandler(this.OnDoubleClickDG);
...
protected void OnDoubleClickDG(EventArgs e)
{}
But i get an error
TNX for help
Marry Christmas
-
December 17th, 2002, 07:06 AM
#2
System.EventHandler c-tor takes two parameters. The first one is of type object, the second one is EventArgs. So rewrite your OnDoubleClickDG function:
Code:
protected void OnDoubleClickDG(object sender, EventArgs e);
{
// Implementation
}
Regarding the other question about the wizards:
When you select your control in Visual Studio designer, go to the properties window. There is icon (something as lightning). Click on it and the content of the window changes to the events... You can select event there...
Martin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|