Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim tpu
If Not IsNumericRegex(TextBox1.Text) Then
tpu = MsgBox("此框中只允许输入数字!", , "错误")
If Len(TextBox1.Text)0 Then
TextBox1.Text = Microsoft.VisualBasic.Left(TextBox1.Text, Len(TextBox1.Text) - 1)
Else
TextBox1.Text = 0
End If
TextBox1.Focus()
TextBox1.SelectAll()
End If
End Sub
用vb.net做计算器的代码怎么写,其中的控件有radiobutton1234,分别代表+-*/,界面代码就不给你贴了,TextBox3显示的是结果 。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim num1 As Integer = 0
Dim num2 As Integer = 0
Dim result As Integer = 0
Try
num1 = Integer.Parse(TextBox1.Text)
Catch ex As Exception
num1 = 0
End Try
Try
num2 = Integer.Parse(TextBox2.Text)
Catch ex As Exception
num2 = 0
End Try
If RadioButton1.Checked Then
result = num1 + num2
ElseIf RadioButton2.Checked Then
result = num1 - num2
ElseIf RadioButton3.Checked Then
result = num1 * num2
Else
result = num1 / num2
End If
TextBox3.Text = result
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
【计算器vb.net 计算器免费下载】计算器vb.net的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于计算器免费下载、计算器vb.net的信息别忘了在本站进行查找喔 。
推荐阅读
- 安娜卖直播设备,抖音主播安娜
- oracle数据库审计作用,oracle关闭数据库审计
- 如何加入新媒体,怎么入行新媒体
- 高性能html5书籍,html畅销书排行榜
- Linux中扩展命令缩写 linux内存扩展
- gis构造镶嵌数据集的简单介绍
- ip代理批量测试,测试代理ip是否可用
- 关于thinkphp3.1.3max的信息
- java灵活定时任务代码 java灵活定时任务代码怎么用