|
-
Jan 17th, 2003, 05:04 PM
#1
Thread Starter
Addicted Member
Events in a usercontrol.
Ok,
I have this code in a usercontrol
PHP Code:
public delegate void commandEntered();
public static event commandEntered doCommand;
but I don't seem to be able to see the event listed in the properties of the control from the form that it is contained on.
Any ideas?
Jeremy
-
Jan 17th, 2003, 08:30 PM
#2
yay gay
whats the difference between a static event and a non-static event?
\m/  \m/
-
Jan 18th, 2003, 10:19 AM
#3
The way you attach to it.
For a normal event you write
Code:
Button button = new Button();
button.Click += new EventHandler(MyHandler);
For a static event you write
Code:
Application.Idle += new EventHandler(MyHandler);
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2003, 10:20 AM
#4
In other words it's probably wrong to make events on a user control static.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Feb 18th, 2003, 02:33 AM
#5
Addicted Member
can some one explain me the whole procedure of declaring Event , adding event and raising the event .. in C# i mean some easy sample code , i had a look .Net help but its seemed bit confused as lot of topic included in tht .. i just want to declare and raise an event in my control .. can some one help ...
-
Feb 18th, 2003, 03:09 AM
#6
Thread Starter
Addicted Member
I think this is the way it goes.
PHP Code:
//define the delegate
delegate void myDelegate();
//define your event from your delegate
event myDelegate myEvent
//raise the event
if (myEvent != null)
{
myEvent();
}
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
|