I have a wizard to make a project, I make us e of a tabcontrol. I have buttons to go to the next tab or the previous. My problem now is that even thought there is validation on the buttons for required field, you can still switch between the tabs by clicking the tab headers. If I disable the tabcontrol, the user can't use whatever is inside the tabs either. Can I solve this?
UPDATE: all the code of the wizard form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WorldEstablisher
{
public partial class ProjectWizard : Form
{
#region variables
public Form1 MainForm { get; set; }
#endregion
#region constructor and page load
public ProjectWizard(Form1 form)
{
InitializeComponent();
MainForm = form;
}
private void ProjectWizard_Load(object sender, EventArgs e)
{
}
#endregion
#region navigation
private void nextButton_Click(object sender, EventArgs e)
{
if (tabs.SelectedIndex == 0)//field validation tab 1
{
if (folderLocationTextBox.Text != "" && worldNameTextBox.Text != "")
{
backButton.Visible = true;
tabs.SelectedIndex = tabs.SelectedIndex + 1;
}
}
if (tabs.SelectedIndex == 1)//field validation tab 2
{
if (authorTextBox.Text != "")
{
tabs.SelectedIndex = tabs.SelectedIndex + 1;
}
}
if (tabs.SelectedIndex == 2)
{
finishButton.Visible = true;
}
}
private void backButton_Click(object sender, EventArgs e)
{
if (tabs.SelectedIndex != 0)
{
tabs.SelectedIndex = tabs.SelectedIndex - 1;
if (tabs.SelectedIndex == 0)//Make the back button invisible
{
backButton.Visible = false;
}
if (tabs.SelectedIndex != 2)//Make the finish button invisible
{
finishButton.Visible = false;
}
}
}
private void finishButton_Click(object sender, EventArgs e)
{
World world = new World("test");
MainForm.CurrentWorld = world;
this.Close();
}
#endregion
private void selectFolderButton_Click(object sender, EventArgs e)
{
if (folderBrowser.ShowDialog() == DialogResult.OK)
{
folderLocationTextBox.Text = folderBrowser.SelectedPath;
}
}
}
}