using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace firstCSharp { class CustomDialog : Form { private Button okButton; private Label courseLabel; private TextBox courseTextBox; private Button cancelButton; public String getCourse() { return courseTextBox.Text; } public CustomDialog() { InitializeComponent(); } private void InitializeComponent() { this.cancelButton = new System.Windows.Forms.Button(); this.okButton = new System.Windows.Forms.Button(); this.courseLabel = new System.Windows.Forms.Label(); this.courseTextBox = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // // cancelButton // this.cancelButton.Location = new System.Drawing.Point(315, 118); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(75, 23); this.cancelButton.TabIndex = 0; this.cancelButton.Text = "Cancel"; this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); // // okButton // this.okButton.Location = new System.Drawing.Point(221, 118); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(75, 23); this.okButton.TabIndex = 1; this.okButton.Text = "OK"; this.okButton.UseVisualStyleBackColor = true; this.okButton.Click += new System.EventHandler(this.okButton_Click); // // courseLabel // this.courseLabel.AutoSize = true; this.courseLabel.Location = new System.Drawing.Point(25, 22); this.courseLabel.Name = "courseLabel"; this.courseLabel.Size = new System.Drawing.Size(40, 13); this.courseLabel.TabIndex = 2; this.courseLabel.Text = "Course"; // // courseTextBox // this.courseTextBox.Location = new System.Drawing.Point(82, 19); this.courseTextBox.Name = "courseTextBox"; this.courseTextBox.Size = new System.Drawing.Size(157, 20); this.courseTextBox.TabIndex = 3; // // CustomDialog // this.ClientSize = new System.Drawing.Size(414, 164); this.Controls.Add(this.courseTextBox); this.Controls.Add(this.courseLabel); this.Controls.Add(this.okButton); this.Controls.Add(this.cancelButton); this.Name = "CustomDialog"; this.ResumeLayout(false); this.PerformLayout(); } private void cancelButton_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } private void okButton_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; this.Close(); } } }