2个页面 TabPages 隐藏了1个之后 就只剩1个 lndex只有0 e.Form.Controls("TabControl1").Selectedlndex = 1
就出错了
试试
Select Case e.StripItem.Name
Case"输入"
e.Form.Controls("TabControl1").TabPages(0).Visible = True
e.Form.Controls("TabControl1").TabPages(1).Visible = False
Case"查询"
e.Form.Controls("TabControl1").TabPages(0).Visible = False
e.Form.Controls("TabControl1").TabPages(1).Visible = True
End Select