i am trying to make a quiz using Visual c++

I am trying to make it so that each tab has a different question and when you press a button it goes to the next tab. Is there a way to do this?

If not is there another way i could do it?
I have considered trying to use different panels for each question and disabling each on and enabling other for each set of questions so this could be my second option is tabs fail.

Thank you.

A bit more info may be required. Are you using MFC or .NET with C++?
If MFC, are you using CTabCtrl?

I've no idea what level you're at but in simple terms you create a button click handler, inside which you:
- query the tab control to find out the index of the currently selected tab
- increment this to the next tab index (check that you haven't got to the end)
- select the new tab in the tab control.

The principle is the same whether you're using MFC or .NET.

A bit more info may be required. Are you using MFC or .NET with C++?
If MFC, are you using CTabCtrl?

I've no idea what level you're at but in simple terms you create a button click handler, inside which you:
- query the tab control to find out the index of the currently selected tab
- increment this to the next tab index (check that you haven't got to the end)
- select the new tab in the tab control.

The principle is the same whether you're using MFC or .NET.

Thank's for the reply. I am not quite sure which but i am using Visual C++ 2008 Express. The code is:

#include<iostream>
#include<string>
#pragma once


namespace lol1 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TabControl^  tabPanel;
	protected: 

	protected: 

	protected: 
	private: System::Windows::Forms::TabPage^  tabPage1;
	private: System::Windows::Forms::TabPage^  tabPage2;
	private: System::Windows::Forms::TabPage^  tabPage3;
	private: System::Windows::Forms::TabPage^  tabPage4;
	private: System::Windows::Forms::TabPage^  tabPage5;
	private: System::Windows::Forms::TabPage^  tabPage6;
	private: System::Windows::Forms::TabPage^  tabPage7;
	private: System::Windows::Forms::TabPage^  tabPage8;
	private: System::Windows::Forms::TabPage^  tabPage9;
	private: System::Windows::Forms::TabPage^  tabPage10;
	private: System::Windows::Forms::TabPage^  tabPage11;
	private: System::Windows::Forms::TabPage^  tabPage12;
	private: System::Windows::Forms::PictureBox^  pictureBox1;
	private: System::Windows::Forms::TextBox^  textBox1;
	private: System::Windows::Forms::Button^  startbutton;
	private: System::Windows::Forms::Panel^  panel1;
	private: System::Windows::Forms::TextBox^  q1text;
	private: System::Windows::Forms::Button^  q1sub;
	private: System::Windows::Forms::RadioButton^  q1ansc;

	private: System::Windows::Forms::RadioButton^  q1ansb;

	private: System::Windows::Forms::RadioButton^  q1ansa;
	private: System::Windows::Forms::TextBox^  q1wrong;

	private: System::Windows::Forms::TextBox^  q1correct;




	private: System::ComponentModel::IContainer^  components;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>


#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
			this->tabPanel = (gcnew System::Windows::Forms::TabControl());
			this->tabPage1 = (gcnew System::Windows::Forms::TabPage());
			this->startbutton = (gcnew System::Windows::Forms::Button());
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
			this->tabPage2 = (gcnew System::Windows::Forms::TabPage());
			this->panel1 = (gcnew System::Windows::Forms::Panel());
			this->q1text = (gcnew System::Windows::Forms::TextBox());
			this->q1sub = (gcnew System::Windows::Forms::Button());
			this->q1ansc = (gcnew System::Windows::Forms::RadioButton());
			this->q1ansb = (gcnew System::Windows::Forms::RadioButton());
			this->q1ansa = (gcnew System::Windows::Forms::RadioButton());
			this->tabPage3 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage4 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage5 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage6 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage7 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage8 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage9 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage10 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage11 = (gcnew System::Windows::Forms::TabPage());
			this->tabPage12 = (gcnew System::Windows::Forms::TabPage());
			this->q1correct = (gcnew System::Windows::Forms::TextBox());
			this->q1wrong = (gcnew System::Windows::Forms::TextBox());
			this->tabPanel->SuspendLayout();
			this->tabPage1->SuspendLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
			this->tabPage2->SuspendLayout();
			this->panel1->SuspendLayout();
			this->SuspendLayout();
			// 
			// tabPanel
			// 
			this->tabPanel->Controls->Add(this->tabPage1);
			this->tabPanel->Controls->Add(this->tabPage2);
			this->tabPanel->Controls->Add(this->tabPage3);
			this->tabPanel->Controls->Add(this->tabPage4);
			this->tabPanel->Controls->Add(this->tabPage5);
			this->tabPanel->Controls->Add(this->tabPage6);
			this->tabPanel->Controls->Add(this->tabPage7);
			this->tabPanel->Controls->Add(this->tabPage8);
			this->tabPanel->Controls->Add(this->tabPage9);
			this->tabPanel->Controls->Add(this->tabPage10);
			this->tabPanel->Controls->Add(this->tabPage11);
			this->tabPanel->Controls->Add(this->tabPage12);
			this->tabPanel->Location = System::Drawing::Point(0, 0);
			this->tabPanel->Name = L"tabPanel";
			this->tabPanel->SelectedIndex = 0;
			this->tabPanel->Size = System::Drawing::Size(858, 550);
			this->tabPanel->TabIndex = 0;
			this->tabPanel->Tag = L"";
			// 
			// tabPage1
			// 
			this->tabPage1->Controls->Add(this->startbutton);
			this->tabPage1->Controls->Add(this->textBox1);
			this->tabPage1->Controls->Add(this->pictureBox1);
			this->tabPage1->Location = System::Drawing::Point(4, 22);
			this->tabPage1->Name = L"tabPage1";
			this->tabPage1->Padding = System::Windows::Forms::Padding(3);
			this->tabPage1->Size = System::Drawing::Size(850, 524);
			this->tabPage1->TabIndex = 0;
			this->tabPage1->Text = L"Intro";
			this->tabPage1->UseVisualStyleBackColor = true;
			// 
			// startbutton
			// 
			this->startbutton->Location = System::Drawing::Point(389, 472);
			this->startbutton->Name = L"startbutton";
			this->startbutton->Size = System::Drawing::Size(75, 23);
			this->startbutton->TabIndex = 1;
			this->startbutton->Text = L"Start!";
			this->startbutton->UseVisualStyleBackColor = true;
			this->startbutton->Click += gcnew System::EventHandler(this, &Form1::startbutton_Click);
			// 
			// textBox1
			// 
			this->textBox1->BackColor = System::Drawing::SystemColors::Menu;
			this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::None;
			this->textBox1->Dock = System::Windows::Forms::DockStyle::Top;
			this->textBox1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->textBox1->Location = System::Drawing::Point(3, 3);
			this->textBox1->Multiline = true;
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(844, 57);
			this->textBox1->TabIndex = 1;
			this->textBox1->Text = L"CAD Quiz - What Do You Know\?";
			this->textBox1->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
			// 
			// pictureBox1
			// 
			this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
			this->pictureBox1->Location = System::Drawing::Point(148, 66);
			this->pictureBox1->Name = L"pictureBox1";
			this->pictureBox1->Size = System::Drawing::Size(600, 400);
			this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::CenterImage;
			this->pictureBox1->TabIndex = 0;
			this->pictureBox1->TabStop = false;
			// 
			// tabPage2
			// 
			this->tabPage2->Controls->Add(this->panel1);
			this->tabPage2->Location = System::Drawing::Point(4, 22);
			this->tabPage2->Name = L"tabPage2";
			this->tabPage2->Padding = System::Windows::Forms::Padding(3);
			this->tabPage2->Size = System::Drawing::Size(850, 524);
			this->tabPage2->TabIndex = 1;
			this->tabPage2->Text = L"Question 1";
			this->tabPage2->UseVisualStyleBackColor = true;
			// 
			// panel1
			// 
			this->panel1->Controls->Add(this->q1wrong);
			this->panel1->Controls->Add(this->q1correct);
			this->panel1->Controls->Add(this->q1text);
			this->panel1->Controls->Add(this->q1sub);
			this->panel1->Controls->Add(this->q1ansc);
			this->panel1->Controls->Add(this->q1ansb);
			this->panel1->Controls->Add(this->q1ansa);
			this->panel1->Dock = System::Windows::Forms::DockStyle::Fill;
			this->panel1->Location = System::Drawing::Point(3, 3);
			this->panel1->Name = L"panel1";
			this->panel1->Size = System::Drawing::Size(844, 518);
			this->panel1->TabIndex = 0;
			// 
			// q1text
			// 
			this->q1text->BackColor = System::Drawing::SystemColors::Menu;
			this->q1text->BorderStyle = System::Windows::Forms::BorderStyle::None;
			this->q1text->Font = (gcnew System::Drawing::Font(L"Times New Roman", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->q1text->Location = System::Drawing::Point(70, 53);
			this->q1text->Multiline = true;
			this->q1text->Name = L"q1text";
			this->q1text->ReadOnly = true;
			this->q1text->Size = System::Drawing::Size(644, 68);
			this->q1text->TabIndex = 4;
			this->q1text->Text = L"What Does \'CAD\' Stand For\?";
			this->q1text->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->q1text->TextChanged += gcnew System::EventHandler(this, &Form1::q1text_TextChanged);
			// 
			// q1sub
			// 
			this->q1sub->Location = System::Drawing::Point(70, 355);
			this->q1sub->Name = L"q1sub";
			this->q1sub->Size = System::Drawing::Size(75, 23);
			this->q1sub->TabIndex = 3;
			this->q1sub->Text = L"Submit";
			this->q1sub->UseVisualStyleBackColor = true;
			this->q1sub->Click += gcnew System::EventHandler(this, &Form1::q1sub_Click);
			// 
			// q1ansc
			// 
			this->q1ansc->AutoSize = true;
			this->q1ansc->Location = System::Drawing::Point(70, 293);
			this->q1ansc->Name = L"q1ansc";
			this->q1ansc->Size = System::Drawing::Size(170, 17);
			this->q1ansc->TabIndex = 2;
			this->q1ansc->TabStop = true;
			this->q1ansc->Text = L"C: Controlled Additional Design";
			this->q1ansc->UseVisualStyleBackColor = true;
			// 
			// q1ansb
			// 
			this->q1ansb->AutoSize = true;
			this->q1ansb->Location = System::Drawing::Point(70, 237);
			this->q1ansb->Name = L"q1ansb";
			this->q1ansb->Size = System::Drawing::Size(149, 17);
			this->q1ansb->TabIndex = 1;
			this->q1ansb->TabStop = true;
			this->q1ansb->Text = L"B: Computer Aided Design";
			this->q1ansb->UseVisualStyleBackColor = true;
			this->q1ansb->CheckedChanged += gcnew System::EventHandler(this, &Form1::radioButton2_CheckedChanged);
			// 
			// q1ansa
			// 
			this->q1ansa->AutoSize = true;
			this->q1ansa->Location = System::Drawing::Point(70, 181);
			this->q1ansa->Name = L"q1ansa";
			this->q1ansa->Size = System::Drawing::Size(167, 17);
			this->q1ansa->TabIndex = 0;
			this->q1ansa->TabStop = true;
			this->q1ansa->Text = L"A: Computer Added Designing";
			this->q1ansa->UseVisualStyleBackColor = true;
			// 
			// tabPage3
			// 
			this->tabPage3->Location = System::Drawing::Point(4, 22);
			this->tabPage3->Name = L"tabPage3";
			this->tabPage3->Padding = System::Windows::Forms::Padding(3);
			this->tabPage3->Size = System::Drawing::Size(850, 524);
			this->tabPage3->TabIndex = 2;
			this->tabPage3->Text = L"Question 2";
			this->tabPage3->UseVisualStyleBackColor = true;
			// 
			// tabPage4
			// 
			this->tabPage4->Location = System::Drawing::Point(4, 22);
			this->tabPage4->Name = L"tabPage4";
			this->tabPage4->Padding = System::Windows::Forms::Padding(3);
			this->tabPage4->Size = System::Drawing::Size(850, 524);
			this->tabPage4->TabIndex = 3;
			this->tabPage4->Text = L"Question 3";
			this->tabPage4->UseVisualStyleBackColor = true;
			// 
			// tabPage5
			// 
			this->tabPage5->Location = System::Drawing::Point(4, 22);
			this->tabPage5->Name = L"tabPage5";
			this->tabPage5->Padding = System::Windows::Forms::Padding(3);
			this->tabPage5->Size = System::Drawing::Size(850, 524);
			this->tabPage5->TabIndex = 4;
			this->tabPage5->Text = L"Question 4";
			this->tabPage5->UseVisualStyleBackColor = true;
			// 
			// tabPage6
			// 
			this->tabPage6->Location = System::Drawing::Point(4, 22);
			this->tabPage6->Name = L"tabPage6";
			this->tabPage6->Padding = System::Windows::Forms::Padding(3);
			this->tabPage6->Size = System::Drawing::Size(850, 524);
			this->tabPage6->TabIndex = 5;
			this->tabPage6->Text = L"Question  5";
			this->tabPage6->UseVisualStyleBackColor = true;
			// 
			// tabPage7
			// 
			this->tabPage7->Location = System::Drawing::Point(4, 22);
			this->tabPage7->Name = L"tabPage7";
			this->tabPage7->Padding = System::Windows::Forms::Padding(3);
			this->tabPage7->Size = System::Drawing::Size(850, 524);
			this->tabPage7->TabIndex = 6;
			this->tabPage7->Text = L"Question 6";
			this->tabPage7->UseVisualStyleBackColor = true;
			// 
			// tabPage8
			// 
			this->tabPage8->Location = System::Drawing::Point(4, 22);
			this->tabPage8->Name = L"tabPage8";
			this->tabPage8->Padding = System::Windows::Forms::Padding(3);
			this->tabPage8->Size = System::Drawing::Size(850, 524);
			this->tabPage8->TabIndex = 7;
			this->tabPage8->Text = L"Question 7";
			this->tabPage8->UseVisualStyleBackColor = true;
			// 
			// tabPage9
			// 
			this->tabPage9->Location = System::Drawing::Point(4, 22);
			this->tabPage9->Name = L"tabPage9";
			this->tabPage9->Padding = System::Windows::Forms::Padding(3);
			this->tabPage9->Size = System::Drawing::Size(850, 524);
			this->tabPage9->TabIndex = 8;
			this->tabPage9->Text = L"Question 8";
			this->tabPage9->UseVisualStyleBackColor = true;
			// 
			// tabPage10
			// 
			this->tabPage10->Location = System::Drawing::Point(4, 22);
			this->tabPage10->Name = L"tabPage10";
			this->tabPage10->Padding = System::Windows::Forms::Padding(3);
			this->tabPage10->Size = System::Drawing::Size(850, 524);
			this->tabPage10->TabIndex = 9;
			this->tabPage10->Text = L"Question 9";
			this->tabPage10->UseVisualStyleBackColor = true;
			// 
			// tabPage11
			// 
			this->tabPage11->Location = System::Drawing::Point(4, 22);
			this->tabPage11->Name = L"tabPage11";
			this->tabPage11->Padding = System::Windows::Forms::Padding(3);
			this->tabPage11->Size = System::Drawing::Size(850, 524);
			this->tabPage11->TabIndex = 10;
			this->tabPage11->Text = L"Question 10";
			this->tabPage11->UseVisualStyleBackColor = true;
			// 
			// tabPage12
			// 
			this->tabPage12->Location = System::Drawing::Point(4, 22);
			this->tabPage12->Name = L"tabPage12";
			this->tabPage12->Padding = System::Windows::Forms::Padding(3);
			this->tabPage12->Size = System::Drawing::Size(850, 524);
			this->tabPage12->TabIndex = 11;
			this->tabPage12->Text = L"End";
			this->tabPage12->UseVisualStyleBackColor = true;
			// 
			// q1correct
			// 
			this->q1correct->BackColor = System::Drawing::Color::White;
			this->q1correct->BorderStyle = System::Windows::Forms::BorderStyle::None;
			this->q1correct->Enabled = false;
			this->q1correct->Font = (gcnew System::Drawing::Font(L"Times New Roman", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->q1correct->ForeColor = System::Drawing::Color::Green;
			this->q1correct->Location = System::Drawing::Point(420, 178);
			this->q1correct->Multiline = true;
			this->q1correct->Name = L"q1correct";
			this->q1correct->ReadOnly = true;
			this->q1correct->Size = System::Drawing::Size(281, 50);
			this->q1correct->TabIndex = 5;
			this->q1correct->Text = L"Correct Answer";
			this->q1correct->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->q1correct->Visible = false;
			// 
			// q1wrong
			// 
			this->q1wrong->BackColor = System::Drawing::Color::White;
			this->q1wrong->BorderStyle = System::Windows::Forms::BorderStyle::None;
			this->q1wrong->Enabled = false;
			this->q1wrong->Font = (gcnew System::Drawing::Font(L"Times New Roman", 15.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->q1wrong->ForeColor = System::Drawing::Color::Red;
			this->q1wrong->Location = System::Drawing::Point(420, 260);
			this->q1wrong->Multiline = true;
			this->q1wrong->Name = L"q1wrong";
			this->q1wrong->ReadOnly = true;
			this->q1wrong->ShortcutsEnabled = false;
			this->q1wrong->Size = System::Drawing::Size(281, 118);
			this->q1wrong->TabIndex = 6;
			this->q1wrong->Text = L"Wrong Answer - Correct Answer Was:\r\n\r\nB: Computer Aided Design";
			this->q1wrong->TextAlign = System::Windows::Forms::HorizontalAlignment::Center;
			this->q1wrong->Visible = false;
			this->q1wrong->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(858, 550);
			this->Controls->Add(this->tabPanel);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->tabPanel->ResumeLayout(false);
			this->tabPage1->ResumeLayout(false);
			this->tabPage1->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
			this->tabPage2->ResumeLayout(false);
			this->panel1->ResumeLayout(false);
			this->panel1->PerformLayout();
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			 }
private: System::Void [B]startbutton_Click[/B](System::Object^  sender, System::EventArgs^  e) {

		 }

private: System::Void q1text_TextChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void radioButton2_CheckedChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void textBox2_TextChanged(System::Object^  sender, System::EventArgs^  e) {
		 }
private: System::Void q1sub_Click(System::Object^  sender, System::EventArgs^  e) {
	}
};
}

I am trying to make startbutton_Click goto the 2nd tab.

Oh, never mind i just messed around till i found it. It is:

this->tabPanel->SelectTab(tabPage2);

Thanks for the help thought (:

This question has already been answered. Start a new discussion instead.