vb,要求在文本框1中输入一个数,选择单选按钮Sqr或Exp计算,单击命令按钮后在文本框2中显示结果。

急求,谢啦~

第1个回答  2012-05-16
假设命令按钮为commandbutton1
单选按钮option1(0) 为Sqr
option1(1)为Exp

写以下程序
Private Sub Command1_Click()
If Option1(0).Value Then
Text2.Text = Sqr(Val(Text1.Text))
Else
Text2.Text = Exp(Val(Text1.Text))
End If
End Sub
第2个回答  2012-05-15
dim a as integer
a = Cint(textBox1.Text)
dim d
if radiobutton1.checked=true then
d = sqrt(a)
elseif radiobutton2.checked=true
d = Exp(a)
end if
textbox2.text = d本回答被提问者采纳
相似回答