vb.net数组计算器 vb数组运算

您好,我想用vb 。net编一个计算器,就是设置了几个数字键,摁一下显示一个数字,比如输入67该怎么编写操作过程:
1获取你摁的第一个数字值,比如6,把它转换成字符串"6",设置在文本框txtNum中.
2获取你按的第二个数字值,比如7,转换成字符串,设置文本框
txtNum.text += "7" 这样就出现了"67"的显示了.
VB.NET怎么编模拟袖珍计算器的完整程序?Public C护激篙刻蕻灸戈熏恭抹lass Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim c As Char
c = Trim(TextBox3.Text)
Select Case c
Case "+"
TextBox4.Text = Val(TextBox1.Text) + Val(TextBox2.Text)
Case "-"
TextBox4.Text = Val(TextBox1.Text) - Val(TextBox2.Text)
Case "*"
TextBox4.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
Case "\"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) \ Val(TextBox2.Text)
End If
Case "/"
If Val(TextBox2.Text) = 0 Then
MsgBox("分母为0")
Else
TextBox4.Text = Val(TextBox1.Text) / Val(TextBox2.Text)
End If
End Select
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
有关vb.net制作计算器的问题判断吧,如果点击+按钮,则一个全局变量为1,-按钮,则全局变量为2.以此类推 , 然后if或case判断哪个数,如果为1,就两个数相加 。
如何用vb.net编写一个简单的计算器程序?。慷嘈话?/h2>vb.net数组计算器你自己加窗体和空件吧
Private Sub a1_Click()
X = Val(Text1.Text)
Y = Val(Text2.Text)
s = X + Y
Text3.Text = s
Text3.Locked = True
End Sub
Private Sub a2_Click()
X = Val(Text1.Text)
Y = Val(Text2.Text)
s = X - Y
Text3.Text = s
Text3.Locked = True
End Sub
Private Sub a3_Click()
X = Val(Text1.Text)
Y = Val(Text2.Text)
s = X * Y
Text3.Text = s
Text3.Locked = True
End Sub
Private Sub a4_Click()
X = Val(Text1.Text)
Y = Val(Text2.Text)
s = X / Y
Text3.Text = s
Text3.Locked = True
End Sub
不会vb.net数组计算器的叫vb.net数组计算器我 在线谈
用VB.NET编的计算器程序!Public Class SimpleCalculator
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的 。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表 。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程 。
'不要使用代码编辑器修改它 。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button

推荐阅读