您好,我想用vb 。net编一个计算器,就是设置了几个数字键,摁一下显示一个数字,比如输入67该怎么编写操作过程:
1获取你摁的第一个数字值,比如6,把它转换成字符串"6",设置在文本框txtNum中.
2获取你按的第二个数字值,比如7,转换成字符串,设置文本框
txtNum.text += "7" 这样就出现了"67"的显示了.
用VB.NET编的计算器程序!Public Class SimpleCalculator
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成vb.net计算器编码的代码 "
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
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button
Friend WithEvents Button11 As System.Windows.Forms.Button
Friend WithEvents Button12 As System.Windows.Forms.Button
Friend WithEvents Button13 As System.Windows.Forms.Button
Friend WithEvents Button14 As System.Windows.Forms.Button
Friend WithEvents Button15 As System.Windows.Forms.Button
Friend WithEvents Button16 As System.Windows.Forms.Button
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.Button10 = New System.Windows.Forms.Button
Me.Button11 = New System.Windows.Forms.Button
Me.Button12 = New System.Windows.Forms.Button
Me.Button13 = New System.Windows.Forms.Button
Me.Button14 = New System.Windows.Forms.Button
Me.Button15 = New System.Windows.Forms.Button
Me.Button16 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 16)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(48, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "结果:"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(64, 8)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
推荐阅读
- 电脑直播伴侣分享直播间,电脑直播伴侣怎么连接手机
- hbase过滤器多重使用,hbase查询条件过滤
- 小米4c怎么设置u盘,小米4cusb调试在哪里
- 明星直播开场素材,明星直播宣传文案
- linux关掉网卡命令 linux关闭网卡命令
- 第二个路由器怎么设定密码,第二个路由器怎么设定密码和网络
- mysql注释怎么看 mysql中的注释
- 如何开展竞价推广网站,如何开展竞价推广网站营销
- 开封电信dns服务器,河南电信的dns是多少