Hi, i am new to Visual C++ and facing problem in integrating two combo boxes.
Here is what i need:
Combobox1 - Material of Plate:
Choice: Metal or Plastic
Combobox2 - Thickness of Plate:
Choice: if Metal in Combobox1: 2,3,4,5,6
Choice: if Plastic in Combobox1: 8,10,15
I am unable to solve the problem, can any one help me out with the this!...any help is highly appreciated...!
The code is as follows:
#pragma once
namespace Program {
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::ComboBox^ comboBox1;
protected:
private: System::Windows::Forms::ComboBox^ comboBox2;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label4;
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;
#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)
{
this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
this->comboBox2 = (gcnew System::Windows::Forms::ComboBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// comboBox1
//
this->comboBox1->FormattingEnabled = true;
this->comboBox1->Items->AddRange(gcnew cli::array< System::Object^ >(2) {L"Metal", L"Plastic"});
this->comboBox1->Location = System::Drawing::Point(142, 34);
this->comboBox1->Name = L"comboBox1";
this->comboBox1->Size = System::Drawing::Size(71, 21);
this->comboBox1->TabIndex = 0;
//
// comboBox2
//
this->comboBox2->FormattingEnabled = true;
this->comboBox2->Items->AddRange(gcnew cli::array< System::Object^ >(5) {L"2", L"3", L"4", L"5", L"6"});
this->comboBox2->Location = System::Drawing::Point(142, 62);
this->comboBox2->Name = L"comboBox2";
this->comboBox2->Size = System::Drawing::Size(71, 21);
this->comboBox2->TabIndex = 1;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(30, 37);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(83, 13);
this->label1->TabIndex = 2;
this->label1->Text = L"Material of Plate";
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(30, 65);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(95, 13);
this->label2->TabIndex = 3;
this->label2->Text = L"Thickness of Plate";
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(219, 65);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(23, 13);
this->label4->TabIndex = 5;
this->label4->Text = L"mm";
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(287, 138);
this->Controls->Add(this->label4);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->comboBox2);
this->Controls->Add(this->comboBox1);
this->Name = L"Form1";
this->Text = L"Form1";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
};
}