既にフォームに作成されて いる値のようなtextboxes
変数を実行時に生成する配列があります。textboxes
textbox
int n;
TextBox[] tb;
public void AggiungiArmoniche()
{
n = int.Parse(textBox4.Text);
tb = new
TextBox[n];
for (int i = 1; i < tb.Length; i++)
{
tb[i] = new TextBox();
tb[i].Name = "textBox" + i;
tb[i].Location = new Point(100 *i, 163);
tb[i].Size = new Size(48, 20);
tb[i].KeyPress += System.Windows.Forms.KeyPressEventHandler(textBoxP_KeyPress);
groupBox1.Controls.Add(tb[i]);
}
}
private void textBoxP_KeyPress(object sender, KeyPressEventArgs e)
{
// statements of the event
}
イベントをイベント ハンドラーに関連付ける行に移動すると、エラーが発生し、コンテストで有効な構成ではありません」(特に単語keypresseventhandler
)
関連付けに構文エラーがありますか?