添加文本框:
Private Sub plus_Click()
Dim qianglei, zuofa, zuofa_s, cailiao, cailiao_s, jisuan As Object
Static a1, a2, b1, b2, c1, c2, x1, x2, y1, y2, z1, z2, N As Long
N = N + 1
Set qianglei = Form1.Controls.Add("VB.textbox", "qianglei" & a1)
With qianglei
.Visible = True
.Width = 1455
.Height = 315
a2 = a2 + 500
.Top = a2
.Left = 360
a1 = a1 + 1
End With
Set zuofa = Form1.Controls.Add("VB.textbox", "zuofa" & b1)
With zuofa
.Visible = True
.Width = 700
.Height = 315
b2 = b2 + 500
.Top = b2
.Left = 1920
b1 = b1 + 1
End With
Set zuofa_s = Form1.Controls.Add("VB.textbox", "zuofa_s" & x1)
With zuofa_s
.Visible = True
.Width = 700
.Height = 315
x2 = x2 + 500
.Top = x2
.Left = 2650
x1 = x1 + 1
End With
Set cailiao = Form1.Controls.Add("VB.textbox", "cailiao" & c1)
With cailiao
.Visible = True
.Width = 700
.Height = 315
c2 = c2 + 500
.Top = c2
.Left = 3480
c1 = c1 + 1
End With
Set cailiao_s = Form1.Controls.Add("VB.textbox", "cailiao_s" & y1)
With cailiao_s
.Visible = True
.Width = 700
.Height = 315
y2 = y2 + 500
.Top = y2
.Left = 4230
y1 = y1 + 1
End With
Set jisuan = Form1.Controls.Add("VB.commandbutton", "jisuanbutton" & z1)
With jisuan
.Visible = True
.Width = 300
.Height = 280
z2 = z2 + 500
.Top = z2
.Left = 5100
z1 = z1 + 1
End With
Dim jieguo As Object
Static p1, p2 As Long
Set jieguo = Form1.Controls.Add("VB.label", "jieguo" & p1)
With jieguo
.Visible = True
.Width = 1455
.Height = 315
p2 = p2 + 500
.Top = p2
.Left = 5600
p1 = p1 + 1
End With
jieguo = zuofa_shuju * qianglei_shuju
End Sub
我想通过这个单击事件添加几个文本框和一个按钮,然后单击按钮后选取其中文本框的内容进行运算并输出结果。
求指教