daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest May 17th, 2018 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Trie
  12. {
  13.     public partial class InputNumber : Form
  14.     {
  15.         public string wrd;
  16.         private Label label1;
  17.         private Label label2;
  18.         private TextBox tbWord;
  19.         private TextBox tbNumber;
  20.         private Button btnOk;
  21.         private Button btnCancel;
  22.         public int n;
  23.  
  24.         public InputNumber()
  25.         {
  26.             InitializeComponent();
  27.             btnOk.NotifyDefault(true);
  28.         }
  29.  
  30.         private void btnOk_Click(object sender, EventArgs e)
  31.         {
  32.             if (!Node.CheckWord(tbWord.Text))
  33.             {
  34.                 MessageBox.Show("Wrong word!", "");
  35.                 tbWord.Focus();
  36.                 return;
  37.             }
  38.             if (!int.TryParse(tbNumber.Text, out n) || n < 0)
  39.             {
  40.                 MessageBox.Show("Wrong number!", "");
  41.                 tbNumber.Focus();
  42.                 return;
  43.             }
  44.             wrd = tbWord.Text;
  45.             DialogResult = DialogResult.OK;
  46.         }
  47.  
  48.         private void InitializeComponent()
  49.         {
  50.             this.label1 = new System.Windows.Forms.Label();
  51.             this.label2 = new System.Windows.Forms.Label();
  52.             this.tbWord = new System.Windows.Forms.TextBox();
  53.             this.tbNumber = new System.Windows.Forms.TextBox();
  54.             this.btnOk = new System.Windows.Forms.Button();
  55.             this.btnCancel = new System.Windows.Forms.Button();
  56.             this.SuspendLayout();
  57.             //
  58.             // label1
  59.             //
  60.             this.label1.AutoSize = true;
  61.             this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  62.             this.label1.Location = new System.Drawing.Point(17, 25);
  63.             this.label1.Name = "label1";
  64.             this.label1.Size = new System.Drawing.Size(68, 16);
  65.             this.label1.TabIndex = 0;
  66.             this.label1.Text = "Input word";
  67.             //
  68.             // label2
  69.             //
  70.             this.label2.AutoSize = true;
  71.             this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  72.             this.label2.Location = new System.Drawing.Point(17, 64);
  73.             this.label2.Name = "label2";
  74.             this.label2.Size = new System.Drawing.Size(84, 16);
  75.             this.label2.TabIndex = 1;
  76.             this.label2.Text = "Input number";
  77.             //
  78.             // tbWord
  79.             //
  80.             this.tbWord.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  81.             this.tbWord.Location = new System.Drawing.Point(119, 22);
  82.             this.tbWord.Name = "tbWord";
  83.             this.tbWord.Size = new System.Drawing.Size(139, 22);
  84.             this.tbWord.TabIndex = 2;
  85.             //
  86.             // tbNumber
  87.             //
  88.             this.tbNumber.Location = new System.Drawing.Point(119, 63);
  89.             this.tbNumber.Name = "tbNumber";
  90.             this.tbNumber.Size = new System.Drawing.Size(139, 20);
  91.             this.tbNumber.TabIndex = 3;
  92.             //
  93.             // btnOk
  94.             //
  95.             this.btnOk.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  96.             this.btnOk.Location = new System.Drawing.Point(20, 119);
  97.             this.btnOk.Name = "btnOk";
  98.             this.btnOk.Size = new System.Drawing.Size(75, 23);
  99.             this.btnOk.TabIndex = 4;
  100.             this.btnOk.Text = "Ok";
  101.             this.btnOk.UseVisualStyleBackColor = true;
  102.             this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
  103.             //
  104.             // btnCancel
  105.             //
  106.             this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  107.             this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  108.             this.btnCancel.Location = new System.Drawing.Point(183, 119);
  109.             this.btnCancel.Name = "btnCancel";
  110.             this.btnCancel.Size = new System.Drawing.Size(75, 23);
  111.             this.btnCancel.TabIndex = 5;
  112.             this.btnCancel.Text = "Cancel";
  113.             this.btnCancel.UseVisualStyleBackColor = true;
  114.             //
  115.             // InputNumber
  116.             //
  117.             this.AcceptButton = this.btnOk;
  118.             this.CancelButton = this.btnCancel;
  119.             this.ClientSize = new System.Drawing.Size(284, 156);
  120.             this.Controls.Add(this.btnCancel);
  121.             this.Controls.Add(this.btnOk);
  122.             this.Controls.Add(this.tbNumber);
  123.             this.Controls.Add(this.tbWord);
  124.             this.Controls.Add(this.label2);
  125.             this.Controls.Add(this.label1);
  126.             this.Name = "InputNumber";
  127.             this.ResumeLayout(false);
  128.             this.PerformLayout();
  129.  
  130.         }
  131.     }
  132. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top