C# コントロールをまとめる
これでコントロールが振り分けられる。
TextBox tbComb0; TextBox tbComb1; private void tbCode_KeyPress(object sender, KeyPressEventArgs e) { int n = -1; if (sender.Equals(tbComb0)) { n = 0; } else if (sender.Equals(tbComb1)) { n = 1; } }
これでコントロールが振り分けられる。
TextBox tbComb0; TextBox tbComb1; private void tbCode_KeyPress(object sender, KeyPressEventArgs e) { int n = -1; if (sender.Equals(tbComb0)) { n = 0; } else if (sender.Equals(tbComb1)) { n = 1; } }