?? form1.vb
字號(hào):
Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows 窗體設(shè)計(jì)器生成的代碼 "
Public Sub New()
MyBase.New()
'該調(diào)用是 Windows 窗體設(shè)計(jì)器所必需的。
InitializeComponent()
'在 InitializeComponent() 調(diào)用之后添加任何初始化
End Sub
'窗體重寫 dispose 以清理組件列表。
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 窗體設(shè)計(jì)器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下過程是 Windows 窗體設(shè)計(jì)器所必需的
'可以使用 Windows 窗體設(shè)計(jì)器修改此過程。
'不要使用代碼編輯器修改它。
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 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.Label2 = New System.Windows.Forms.Label
Me.Label3 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(32, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(64, 24)
Me.Label1.TabIndex = 0
Me.Label1.Text = "帳單金額"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(128, 24)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(144, 21)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(32, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(64, 24)
Me.Label2.TabIndex = 0
Me.Label2.Text = "應(yīng)付小費(fèi)"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(128, 80)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(144, 24)
Me.Label3.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(56, 128)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 2
Me.Button1.Text = "計(jì)算"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(168, 128)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(72, 24)
Me.Button2.TabIndex = 2
Me.Button2.Text = "清除"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(292, 174)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Button2)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As Double
Try
a = Double.Parse(TextBox1.Text)
Catch ex As System.FormatException
MessageBox.Show("輸入的不是一個(gè)數(shù)")
Exit Sub
Catch ex As System.OverflowException
MessageBox.Show("輸入的值超出Double表示范圍")
Exit Sub
End Try
a = a * 0.15
If a < 1 Then
Label3.Text = 1
Else : Label3.Text = a
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Label3.Text = ""
TextBox1.Text = ""
End Sub
End Class
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -