Answered Tabs in Winform

Answers

  • Wednesday, April 25, 2007 12:26 PM
    Moderator
     
     Answered
    Add a new class to your project and paste the code shown below.  Build.  You can now drop the control from the top of the toolbox onto your form.  At design time, the control looks like a regular TabControl.  At run-time, you only see the pages.  Use the SelectedIndex property to step through the pages.

    using System;
    using System.Windows.Forms;

    public class WizardPages : TabControl {
      protected override void WndProc(ref Message m) {
        // Hide tabs by trapping the TCM_ADJUSTRECT message
        if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
        else base.WndProc(ref m);
      }
    }

All Replies

  • Wednesday, April 25, 2007 8:03 AM
     
     

    Hi :

    Do you means switch form one tab to another to create a wizard?

    for tabs control, you can find some samples in follow link

    http://www.dotnetrix.co.uk/tabcontrols.html

  • Wednesday, April 25, 2007 11:50 AM
     
     
    No I'm trying to use tabs as wizard page, how I can hide table pager.

    Or Is there any wizard control?
  • Wednesday, April 25, 2007 12:26 PM
    Moderator
     
     Answered
    Add a new class to your project and paste the code shown below.  Build.  You can now drop the control from the top of the toolbox onto your form.  At design time, the control looks like a regular TabControl.  At run-time, you only see the pages.  Use the SelectedIndex property to step through the pages.

    using System;
    using System.Windows.Forms;

    public class WizardPages : TabControl {
      protected override void WndProc(ref Message m) {
        // Hide tabs by trapping the TCM_ADJUSTRECT message
        if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
        else base.WndProc(ref m);
      }
    }
  • Thursday, August 02, 2007 4:49 PM
     
     

    I tried pasting this code, building, adding a tab control, and running, but it didn't work - the tab buttons still showed.  Why?

    Thanks so much.

     

  • Thursday, August 02, 2007 5:07 PM
    Moderator
     
     
    Did you add a TabControl or did you add WizardPages?  It's on the top of the toolbox.
  • Thursday, August 02, 2007 5:29 PM
     
     
    Oops!  Now I get it.  Thanks so much!

     

  • Tuesday, November 06, 2007 2:38 PM
     
     
    That works great! Any suggestions of what actions needed to make it work through IE as aciveX? Standard TabControl works fine as activeX. 

    Thanks in advance
  • Wednesday, December 24, 2008 12:58 AM
     
     

    I followed some examples to do the above in vb.net, but when I drag and drop the control

    on my form in vs2005 and build I get and error message "type " myproject.WizardPages "is not defined"

    When I click on the error it brings me to the xx.Designer.vb where I see the following >>

    me.WizardPages1 = New myproject.WizardPages  

    If I remove myproject or add global.project it fixes the problem ,

    but every time I mod the form the same thing re-appears over and over again !!!

    Did I miss something ???  Is there some magic way to permanently fix this problem ???

    What is the correct way to use project.class widgets in vb.net ????

    I have tried to use various combinations of import statements , but to no avail

  • Sunday, November 01, 2009 7:33 PM
     
     
    Hi,

    This works great. But there is a small bug if there are multiple tabs for this wizard and the width of the wizard is widely enough to handle all tab headers. Then there are two buttons like: << >> How can we also make these two buttons invisible in this case?

    Thanks in advance.
  • Thursday, November 12, 2009 12:44 AM
     
     
    nobugz,

    I like this solution, it's handy, with minimal overhead, and eliminates the need to introduce a third party library for a wizard control.
    I'm having a problem though.  I add a class (WizardPages.cs), copy/paste, build successfully, but the control does not appear anywhere
    in the toolbox. Not sure if I'm doing something wrong, can you advise? Your help is appreciated.  Cheers.
  • Thursday, January 13, 2011 9:08 AM
     
     
    Add a new class to your project and paste the code shown below.  Build.  You can now drop the control from the top of the toolbox onto your form.  At design time, the control looks like a regular TabControl.  At run-time, you only see the pages.  Use the SelectedIndex property to step through the pages.

    using System;
    using System.Windows.Forms;

    public class WizardPages : TabControl {
      protected override void WndProc(ref Message m) {
        // Hide tabs by trapping the TCM_ADJUSTRECT message
        if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
        else base.WndProc(ref m);
      }
    }

     I've tried it and it works.
  • Saturday, November 12, 2011 4:15 AM
     
      Has Code

    An alternative could unclude a reference to your .Classes namespace:

    using System;
    using System.Windows.Forms;
    
    namespace YourProjectName.Classes
    {
        public class WizardPages : TabControl
        {
            protected override void WndProc(ref Message m)
            {
                // Hide tabs by trapping the TCM_ADJUSTRECT message
                if (m.Msg == 0x1328 && !DesignMode) m.Result = (IntPtr)1;
                else base.WndProc(ref m);
            }
        }
    }
    

     


    Dominik Ras mintol1@poczta.onet.pl