CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2012

    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.



  2. #2
    Join Date
    Jun 2011
    Buenos Aires, Argentina

    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:
    this.pushButton.Click += new EventHandler(pushButton_Click);
    If you TAB a lot VS will take care of almost everything for you.

    Not sure if this is what you meant... but I hope it helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.