#pragma once #using #using #using #using using namespace System; using namespace System::Drawing; using namespace System::Windows::Forms; //Creating a new dialog class called DialogDataForm public __gc class DialogDataForm : public System::Windows::Forms::Form { public: DialogDataForm(void) { InitializeComponent(); //To detail what we want in the dilaog box } //The following "protected" section is for Windows housekeeping protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::Label *label1; //To store Title for the dialog public: System::Windows::Forms::TextBox *textBox1; //For the user to enter the string private: System::Windows::Forms::Button *buttonSubmit; //The Send button //provide interface for extending properties to other components in the container private: System::ComponentModel::Container* components; void InitializeComponent(void) { this->label1 = new System::Windows::Forms::Label(); this->textBox1 = new System::Windows::Forms::TextBox(); this->buttonSubmit = new System::Windows::Forms::Button(); this->SuspendLayout(); // // Defining and positioning label1 // this->label1->Location = System::Drawing::Point(20, 32); this->label1->Name = "label1"; this->label1->Size = System::Drawing::Size(136, 32); this->label1->TabIndex = 0; this->label1->Text = "Value "; //String label to the left of the text box // // Defining and positioning textBox1 // this->textBox1->Location = System::Drawing::Point(68, 32); this->textBox1->Name = "textBox1"; this->textBox1->Size = System::Drawing::Size(200, 20); this->textBox1->TabIndex = 1; this->textBox1->Text = ""; // // Defining and positioning buttonSubmit // this->buttonSubmit->Location = System::Drawing::Point(106, 70); //Location of button this->buttonSubmit->Name = "buttonSubmit"; //name of button this->buttonSubmit->Size = System::Drawing::Size(72, 24); //Size of button this->buttonSubmit->TabIndex = 1; //Default button index, if more than one this->buttonSubmit->Text = "Submit"; //Text in button this->buttonSubmit->Click += new System::EventHandler(this, onClickSubmit); // // Defining and positioning the DialogDataForm // this->AutoScaleBaseSize = System::Drawing::Size(5, 13); this->ClientSize = System::Drawing::Size(310, 100); //Set size of dialog box this->Controls->Add(this->buttonSubmit); //Add the submit button this->Controls->Add(this->textBox1); //Add textBox1 to the dialog this->Controls->Add(this->label1); //Add label1 to the textBox this->Name = "DialogDataForm"; //Name of dialog class this->Text = "Insert Element"; //Caption of Dialog this->StartPosition = FormStartPosition::CenterParent; // Position the dialog box in the center of the form this->FormBorderStyle = FormBorderStyle::Fixed3D; // Set the border style to Fixed3D this->MinimizeBox = false; // Remove the Minimize button this->MaximizeBox = false; // Remove the Maximize button this->ResumeLayout(false); } //Member function "onClickSubmit" for when the buttonSubmit is clicked private: System::Void onClickSubmit(System::Object * sender, System::EventArgs * e) { this->DialogResult = DialogResult::OK; Close(); } };