Hi Friends,

I am trying to make an application which will have a configuration form.That form would be having next and previous buttons. Clicking on next button should display different content on the same form.
Please suggest different ways to accomplish it.

Thanks for reply but wen we use tab control we have to click on tab buttons to switch to different content but what i need is that when we click the next button then the different content should appear just as in case of installation of an application using Windows Installer

In your case I mainly use panels each of which holds some controls.
Next and Previous buttons, Hide\Show Panels with some simple logic increment\decrement Panel index.

I use a custom tab control and hide the tab headers during run time that way you can easily click on the tabs during design time to change the control layout:

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace DataExplorer
{
  public class TabControlEx : TabControl
  {
    /// <summary>
    /// Gets or sets a value indicating whether the tab headers should be drawn
    /// </summary>
    [
    Description("Gets or sets a value indicating whether the tab headers should be drawn"),
    DefaultValue(true)
    ]
    public bool ShowTabHeaders { get; set; }

    public TabControlEx()
      : base()
    {
    }

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

Drop a normal tab control on to a form then open up the form's design file and locate these two lines:

this.tabControl1 = new <ProjectName>.TabControl();
//further down you will find this:
private TabControl tabControl1;

Change them to:

this.tabControl1 = new <ProjectName>.TabControlEx();
private TabControlEx tabControl1;

Switch back to your designer and select the tab control and change the "ShowTabHeaders" value to false.

Comments
Awesome idea!
This article has been dead for over six months. Start a new discussion instead.