[求助]公用过程的格式
程序代码为:
Private Sub Command1_Click()
Dim a As Single, b As Single, c As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = a + b
Label1.Caption = Str(c)
End Sub
Private Sub Command2_Click()
Dim a As Single, b As Single, d As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
d = a * b
Label2.Caption = Str(d)
End Sub
在上面的程序中,"a = Val(Text1.Text) b = Val(Text2.Text)"在两个不同的控件中重复了两次,能不能把这部分重复的内容写在公用过程中,然后在对command1和command2过程中直接对c和d进行计算,不再输入a和b的表达式了。不知道这个公用过程应该怎样写?谢谢!