窗体上添加2个text,1个command Private Sub Command1_Click() x = Text1.Text If x >= 0 Then y = 1 + x ^ 2 Else y = 1 - 2 * x End If Text2.Text = y End Sub本回答被提问者采纳
第2个回答 2012-05-29
可以加一个命令按钮,点击后开始运算,这个可以根据自己想法设置 在窗体上放置两个textbox,为text1和text2,分别输入x,显示y的值 dim x as integer,y as integer x=val(text1) select case 1 case is<0 y=1-2*x case is>=0 y=(1+x)^2 end select text2=str(y)