tab control各タブには と の数がtextboxesあるフォームがlabelsありますbuttons。選択したタブのテキストボックス内のすべてのテキストをユーザーがクリアできるようにしたいと考えています。
私が試してみました
private void resetCurrentPageToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (TextBox t in tabControl1.SelectedTab.Controls)
{
t.Text = "";
}
}
上記のコードInvalidCastExceptionは、 Message とともに をスローしUnable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.Forms.TextBoxます。
Plsは何を間違えましたか、どうすれば修正できますか?