Last active
November 20, 2023 17:08
-
-
Save Abragadabra/462f6f0f9297694ff867c00cbbb8d7b8 to your computer and use it in GitHub Desktop.
Условия, которые позволяют нам проверить поле на то, что в него вводят именно цифры
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// А вот это нам надо, потому что очень удобно | |
if (!char.IsDigit(e.KeyChar) && !char.IsControl(e.KeyChar)) | |
{ | |
e.Handled = true; | |
} | |
// Это старое такое, не знаю когда оно будет нужно | |
if (!Char.IsDigit(e.KeyChar) && !(Char.IsControl(e.KeyChar))) | |
{ | |
if (!(e.KeyChar.ToString() == ",") && (RateTextBox.Text.IndexOf(",") == -1)) | |
{ | |
e.Handled = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment