Skip to content

Commit bf7d441

Browse files
committed
Фикс проверки ввода на ошибки
1 parent 01e1120 commit bf7d441

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Form1.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,12 @@ private void TextBoxFilter(object sender, EventArgs e)
169169
TextBox current = sender as TextBox;
170170
string mask = current.Tag.ToString() == "MotionName" ? @"^\w*$" : @"^[0-9,]*$";
171171
Match match = Regex.Match(current.Text, mask);
172-
if (!match.Success) current.Text = current.Text.Remove(current.Text.Length - 1, 1);
173-
current.SelectionStart = current.Text.Length;
172+
if (!match.Success)
173+
{
174+
int temp = current.SelectionStart;
175+
current.Text = current.Text.Remove(current.SelectionStart-1, 1);
176+
current.SelectionStart = temp-1;
177+
}
174178

175179
AnimationParams CurrentAnim = listBox1.SelectedItem as AnimationParams;
176180

0 commit comments

Comments
 (0)