OK,以VB2010的控制台程序为例
Sub Main()
Dim x As Single, y As Single
x = Val(InputBox("请输入变量值"))
If x >= 0 Then
y = x ^ 2 + 1
End If
If x < 0 Then
y = x ^ -1
End If
Console.Write("x=" & x & ",y=" & y)
Console.ReadKey()
End Sub
直接用,把print换成一个label或textbox控件