用Visual Studio VB,根据控件NumericUpDown中的数值,动态增加和删减TabControl中的TabPage,如何实现? 10
根据控件NumericUpDown中的数值(人数),动态增加和删减TabControl中的TabPage,而且每一个Page里面的控件都是一样的...
根据控件NumericUpDown中的数值(人数),动态增加和删减TabControl中的TabPage,而且每一个Page里面的控件都是一样的
展开
1个回答
展开全部
Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDown1.ValueChanged
Dim tp(NumericUpDown1.Value - 1) As TabPage
TabControl1.TabPages.Clear()
For i As Integer = 0 To tp.Length - 1
tp(i) = New TabPage
tp(i).Text = "新表格 " & i + 1
Next
TabControl1.TabPages.AddRange(tp)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TabControl1.TabPages.Clear()
End Sub
Dim tp(NumericUpDown1.Value - 1) As TabPage
TabControl1.TabPages.Clear()
For i As Integer = 0 To tp.Length - 1
tp(i) = New TabPage
tp(i).Text = "新表格 " & i + 1
Next
TabControl1.TabPages.AddRange(tp)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TabControl1.TabPages.Clear()
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询