Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Trie
- {
- public partial class InputNumber : Form
- {
- public string wrd;
- private Label label1;
- private Label label2;
- private TextBox tbWord;
- private TextBox tbNumber;
- private Button btnOk;
- private Button btnCancel;
- public int n;
- public InputNumber()
- {
- InitializeComponent();
- btnOk.NotifyDefault(true);
- }
- private void btnOk_Click(object sender, EventArgs e)
- {
- if (!Node.CheckWord(tbWord.Text))
- {
- MessageBox.Show("Wrong word!", "");
- tbWord.Focus();
- return;
- }
- if (!int.TryParse(tbNumber.Text, out n) || n < 0)
- {
- MessageBox.Show("Wrong number!", "");
- tbNumber.Focus();
- return;
- }
- wrd = tbWord.Text;
- DialogResult = DialogResult.OK;
- }
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.tbWord = new System.Windows.Forms.TextBox();
- this.tbNumber = new System.Windows.Forms.TextBox();
- this.btnOk = new System.Windows.Forms.Button();
- this.btnCancel = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.label1.Location = new System.Drawing.Point(17, 25);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(68, 16);
- this.label1.TabIndex = 0;
- this.label1.Text = "Input word";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.label2.Location = new System.Drawing.Point(17, 64);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(84, 16);
- this.label2.TabIndex = 1;
- this.label2.Text = "Input number";
- //
- // tbWord
- //
- this.tbWord.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.tbWord.Location = new System.Drawing.Point(119, 22);
- this.tbWord.Name = "tbWord";
- this.tbWord.Size = new System.Drawing.Size(139, 22);
- this.tbWord.TabIndex = 2;
- //
- // tbNumber
- //
- this.tbNumber.Location = new System.Drawing.Point(119, 63);
- this.tbNumber.Name = "tbNumber";
- this.tbNumber.Size = new System.Drawing.Size(139, 20);
- this.tbNumber.TabIndex = 3;
- //
- // btnOk
- //
- this.btnOk.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.btnOk.Location = new System.Drawing.Point(20, 119);
- this.btnOk.Name = "btnOk";
- this.btnOk.Size = new System.Drawing.Size(75, 23);
- this.btnOk.TabIndex = 4;
- this.btnOk.Text = "Ok";
- this.btnOk.UseVisualStyleBackColor = true;
- this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
- //
- // btnCancel
- //
- this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.btnCancel.Location = new System.Drawing.Point(183, 119);
- this.btnCancel.Name = "btnCancel";
- this.btnCancel.Size = new System.Drawing.Size(75, 23);
- this.btnCancel.TabIndex = 5;
- this.btnCancel.Text = "Cancel";
- this.btnCancel.UseVisualStyleBackColor = true;
- //
- // InputNumber
- //
- this.AcceptButton = this.btnOk;
- this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(284, 156);
- this.Controls.Add(this.btnCancel);
- this.Controls.Add(this.btnOk);
- this.Controls.Add(this.tbNumber);
- this.Controls.Add(this.tbWord);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Name = "InputNumber";
- this.ResumeLayout(false);
- this.PerformLayout();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement