teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

3

break漏れ

2018/02/06 10:04

投稿

tacsheaven
tacsheaven

スコア13707

answer CHANGED
@@ -16,6 +16,7 @@
16
16
  foreach(Control control in textbox.FindForm().Controls) {
17
17
  if (control.Name.Equals(newTextBoxName)) {
18
18
  control.Focus();
19
+ break;
19
20
  }
20
21
  }
21
22
  }

2

誤字修正

2018/02/06 10:04

投稿

tacsheaven
tacsheaven

スコア13707

answer CHANGED
@@ -9,12 +9,12 @@
9
9
  TextBox textbox = sender as TextBox;
10
10
  if (textBox.Text.Length == textBox.MaxLength) {
11
11
  Int32 num = 0;
12
- Int32.TryParse(textBox.Name.Substring("textBox".length), out num);
12
+ Int32.TryParse(textBox.Name.Substring("textBox".Length), out num);
13
13
  if (num != 0) {
14
14
  num++;
15
15
  String newTextBoxName = String.Format("textBox{0}", num);
16
16
  foreach(Control control in textbox.FindForm().Controls) {
17
- if (control.Name.equals(newTextBoxName)) {
17
+ if (control.Name.Equals(newTextBoxName)) {
18
18
  control.Focus();
19
19
  }
20
20
  }

1

誤字修正

2018/02/06 10:03

投稿

tacsheaven
tacsheaven

スコア13707

answer CHANGED
@@ -9,12 +9,12 @@
9
9
  TextBox textbox = sender as TextBox;
10
10
  if (textBox.Text.Length == textBox.MaxLength) {
11
11
  Int32 num = 0;
12
- Int32.TryParse(textBox.name.Substring("textBox".length), out num);
12
+ Int32.TryParse(textBox.Name.Substring("textBox".length), out num);
13
13
  if (num != 0) {
14
14
  num++;
15
15
  String newTextBoxName = String.Format("textBox{0}", num);
16
16
  foreach(Control control in textbox.FindForm().Controls) {
17
- if (control.name.equals(newTextBoxName)) {
17
+ if (control.Name.equals(newTextBoxName)) {
18
18
  control.Focus();
19
19
  }
20
20
  }