예제 #1
0
        }//wpisywanie tylko cyfr

        private void TextBox_tylko_liczby(object sender, KeyPressEventArgs e)
        {
            if (!(sender as TextBox).Text.Contains("."))
            {
                Metody_lokalne.Kropka_w_locie((sender as TextBox), e);
            }
            else if ((sender as TextBox).Text.Contains(".") && e.KeyChar == ',' || e.KeyChar == '.')
            {
                e.Handled = true;
            }
            (sender as TextBox).BackColor = Color.White;
        }//wpisywanie tylko cyfr i "."
예제 #2
0
파일: Doplata.cs 프로젝트: merkious/SPOZ
        private void TextBox_kwota_doplaty_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!(sender as TextBox).Text.Contains("."))
            {
                Metody_lokalne.Kropka_w_locie((sender as TextBox), e);
            }

            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && ((e.KeyChar != '.') || (e.KeyChar != ',')))
            {
                e.Handled = true;
            }

            if (Regex.IsMatch((sender as TextBox).Text, @"\.\d\d") && e.KeyChar != 8)
            {
                e.Handled = true;
            }
        }
예제 #3
0
        }//wpisywanie tylko cyfr i "."

        private void TextBox_tylko_liczby_2_po_przecinku(object sender, KeyPressEventArgs e)
        {
            if (!(sender as TextBox).Text.Contains("."))
            {
                Metody_lokalne.Kropka_w_locie((sender as TextBox), e);
            }

            if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && ((e.KeyChar != '.') || (e.KeyChar != ',')))
            {
                e.Handled = true;
            }

            if (Regex.IsMatch((sender as TextBox).Text, @"\.\d\d") && e.KeyChar != 8)
            {
                e.Handled = true;
            }
            (sender as TextBox).BackColor = Color.White;
        }//wpisywanie tylko cyfr i ".", maks 2 miejsca po przecinku