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は何を間違えましたか、どうすれば修正できますか?