|
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace RegionsAddIn
{
/// <summary>
/// Summary description for NewRegionDialog.
/// </summary>
public class NewRegionDialog : System.Windows.Forms.Form
{
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.ErrorProvider errorProvider;
private System.Windows.Forms.TextBox textBoxNewRegion;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private string newRegion;
public NewRegionDialog()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#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>
private void InitializeComponent()
{
this.textBoxNewRegion = new System.Windows.Forms.TextBox();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.errorProvider = new System.Windows.Forms.ErrorProvider();
this.SuspendLayout();
//
// textBoxNewRegion
//
this.textBoxNewRegion.Location = new System.Drawing.Point(8, 16);
this.textBoxNewRegion.Name = "textBoxNewRegion";
this.textBoxNewRegion.Size = new System.Drawing.Size(264, 20);
this.textBoxNewRegion.TabIndex = 0;
this.textBoxNewRegion.Text = "";
//
// buttonOK
//
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(57, 48);
this.buttonOK.Name = "buttonOK";
this.buttonOK.TabIndex = 1;
this.buttonOK.Text = "OK";
this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
//
// buttonCancel
//
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(161, 48);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.TabIndex = 2;
this.buttonCancel.Text = "Cancel";
//
// errorProvider
//
this.errorProvider.ContainerControl = this;
//
// NewRegionDialog
//
this.AcceptButton = this.buttonOK;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(292, 78);
this.ControlBox = false;
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Controls.Add(this.textBoxNewRegion);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "NewRegionDialog";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "New Region Name";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// This is the new region name.
/// </summary>
public string NewRegion
{
get {return newRegion;}
}
/// <summary>
/// Handler for OK button.
/// </summary>
private void buttonOK_Click(object sender, System.EventArgs e)
{
if(textBoxNewRegion.Text.Length == 0)
{
errorProvider.SetError(textBoxNewRegion, "Cannot be zero length");
this.DialogResult = DialogResult.None;
return;
}
newRegion = textBoxNewRegion.Text;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.