TabControl Change event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jason Rangle

    TabControl Change event

    I am not sure how to use this even properly. When I have it as follows I
    have to click on the tabPage1 for anything to show. TIA.

    namespace TabLayout
    {
    public partial class TabLayout : Form
    {
    public TabLayout()
    {
    InitializeCompo nent();
    }

    private void tabPage1_Change (object sender, EventArgs e)
    {
    lblSomeLabel.Te xt = "TESTING";
    }
    }
    }


  • Bruce Wood

    #2
    Re: TabControl Change event

    Well, for starters, I think that you want the SelectedIndexCh anged
    event of the TabControl, because the TabPage doesn't have a Change
    event...?

    Comment

    • Jason Rangle

      #3
      Re: TabControl Change event

      Yeah, looks like I do. I can't figure out how to use it. Any snip you can
      give me?


      "Bruce Wood" <brucewood@cana da.com> wrote in message
      news:1141161692 .719689.151060@ p10g2000cwp.goo glegroups.com.. .[color=blue]
      > Well, for starters, I think that you want the SelectedIndexCh anged
      > event of the TabControl, because the TabPage doesn't have a Change
      > event...?
      >[/color]


      Comment

      • Bruce Wood

        #4
        Re: TabControl Change event

        In the Visual Studio Designer, open the Properties sliding toolbox and
        pin it.

        Select the TabControl. Double-check at the top of the Properties pane
        that you have the TabControl selected and not a TabPage.

        Click on the lightning bolt on the Properties pane.

        Double-click beside the entry that says SelectedIndexCh anged. Visual
        Studio will wire the event for you and create an event handler method,
        then switch you to Code view with your cursor inside the method body.

        Enter whatever code you want to execute when the selected tab changes.

        Note that this code won't run when the tab control is first shown; only
        when the selection changes. So, you'll have to set things up for the
        default tab page (the first one) to show properly when the form is
        first loaded.

        Comment

        • Jason Rangle

          #5
          Re: TabControl Change event

          Thank you so much Bruce, that is exactly where I needed you to put me. I
          appreciate it.

          --Jason
          "Bruce Wood" <brucewood@cana da.com> wrote in message
          news:1141166331 .417503.87720@e 56g2000cwe.goog legroups.com...[color=blue]
          > In the Visual Studio Designer, open the Properties sliding toolbox and
          > pin it.
          >
          > Select the TabControl. Double-check at the top of the Properties pane
          > that you have the TabControl selected and not a TabPage.
          >
          > Click on the lightning bolt on the Properties pane.
          >
          > Double-click beside the entry that says SelectedIndexCh anged. Visual
          > Studio will wire the event for you and create an event handler method,
          > then switch you to Code view with your cursor inside the method body.
          >
          > Enter whatever code you want to execute when the selected tab changes.
          >
          > Note that this code won't run when the tab control is first shown; only
          > when the selection changes. So, you'll have to set things up for the
          > default tab page (the first one) to show properly when the form is
          > first loaded.
          >[/color]


          Comment

          Working...