当前位置:编程学习 > VB >>

怎么用VB.NET编写计算器

怎么用VB.NET编写计算器

好心人教下啊!!跪谢

答案:

Public Class Form1

Private Sub tijiao_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tijiao.Click
Dim a, b, c As String
a = TextBox1.Text
b = TextBox2.Text
If aa(a, b) Then
End If
If Me.jia.Checked Then
MessageBox.Show("结果等于" & Val(a) + Val(b), "提示")
End If
If Me.jian.Checked Then
MessageBox.Show("结果等于" & Val(a) - Val(b), "提示")
End If
If Me.cheng.Checked Then
MessageBox.Show("结果等于" & Val(a) * Val(b), "提示")
End If
If Me.chu.Checked Then
MessageBox.Show("结果等于" & Val(a) / Val(b), "提示")
End If
End Sub
Private Function aa(ByVal bb As String, ByVal cc As String) As Boolean
If bb = "" Then
MessageBox.Show("请输入", " 提示")
aa = False
ElseIf Not IsNumeric(cc) Then
MessageBox.Show("请输入数字", "警告")
aa = False
Else
aa = True
End If
End Function
End Class

什么样的,是很多按钮的嘛?

上一个:VB中pathchange与change的区别
下一个:VB高手进,VB程序详细解释。

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,