-
March 9th, 2006, 01:01 PM
#1
EventHandlers (stupid question)
Okay, this is probably a really dumb question but how do i manually modify what function is called in an event handler an not have Visual Studio change it back automatically after i compile next time? I went to the automatically generated code and just changed the function but VS just switches it back to whatever it originally placed there..
-
March 9th, 2006, 01:06 PM
#2
Re: EventHandlers (stupid question)
I'm not sure I understand the question, but you can manually add a callback to e.g. a buttons click by adding a line line like this
button.Click += new EventHandler(OnClick);
This has to be added after InitializeComponent is called.
Then you have to implement a
private void OnClick(object sender, EventArgs e)
{
}
and you are done.
Jesper
-
March 9th, 2006, 01:12 PM
#3
Re: EventHandlers (stupid question)
Change the event handler using the properties window in designer mode.
or
remove the event handler line from InitializeComponent and put it in form load and then make the change.
-Satish
-
March 10th, 2006, 01:06 PM
#4
Re: EventHandlers (stupid question)
Ah i didn't think to do that, i just added the eventhandler on load.. everything is peachy now. Thanks
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
|