March 25th, 2014, 05:59 PM
How can I call a Event when user clicks a button.
I have a application that has a tab control and I change the font and color on form load.
But now I need to switch the font and color when I user clicks a button event.
I have 8 of these events, each customized to set different tab font and color.
I just do not know how to make this happen.
Any help would be great.
March 26th, 2014, 10:24 AM
Re: How can I call a Event when user clicks a button.
The simplest way would be to open your form designer, and double click on the button that should perform what you need. That should take you to the button click event handler automatically.
For more actions, if you select the button from the form designer, you will see a properties panel where you will have a "lightning" shaped button. There you will find every possible event a button can react to.
If you want to do it programmatically, you can assign a method to the event with something like:
If you TAB a lot VS will take care of almost everything for you.
this.pushButton.Click += new EventHandler(pushButton_Click);
Not sure if this is what you meant... but I hope it helps.
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!