Advertisement
kot025

Form1.cs

Jan 20th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  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 тест_1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.  
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.  
  21.         private void Form1_Load(object sender, EventArgs e)
  22.         {
  23.             button1.Enabled = true;    //блокируем кнопку
  24.  
  25.         }
  26.         private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  27.         {
  28.             if (!Char.IsDigit(e.KeyChar) && !(e.KeyChar.ToString() == "," && textBox1.Text.IndexOf(',') == -1))
  29.             /*сообщение о нажатии клавиши не должно передаваться элементу управления*/
  30.             {
  31.                 e.Handled = true; // запретили дальнейшую обработку нажатой клавиши
  32.             }
  33.             if (e.KeyChar.Equals((char)13))
  34.             {
  35.                 textBox2.Focus(); //Enter
  36.             }
  37.         }
  38.  
  39.         private void label1_Click(object sender, EventArgs e)
  40.         {
  41.  
  42.         }
  43.  
  44.         private void label3_Click(object sender, EventArgs e)
  45.         {
  46.  
  47.         }
  48.  
  49.     }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement