Explanation:
DesignerCode
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.cbover = New System.Windows.Forms.CheckBox()
Me.cbtraveling = New System.Windows.Forms.CheckBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtsales = New System.Windows.Forms.TextBox()
Me.txtcommission = New System.Windows.Forms.TextBox()
Me.txtadditional = New System.Windows.Forms.TextBox()
Me.txttotaldue = New System.Windows.Forms.TextBox()
Me.btnCalculate = New System.Windows.Forms.Button()
Me.btnexit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(32, 29)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(39, 13)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Sales :"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(32, 91)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(86, 13)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Commission Only"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(32, 157)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(95, 13)
Me.Label3.TabIndex = 2
Me.Label3.Text = "Additional Amount:"
'
'cbover
'
Me.cbover.AutoSize = True
Me.cbover.Location = New System.Drawing.Point(228, 46)
Me.cbover.Name = "cbover"
Me.cbover.Size = New System.Drawing.Size(94, 17)
Me.cbover.TabIndex = 3
Me.cbover.Text = "&Over 10 Years"
Me.cbover.UseVisualStyleBackColor = True
'
'cbtraveling
'
Me.cbtraveling.AutoSize = True
Me.cbtraveling.Location = New System.Drawing.Point(228, 80)
Me.cbtraveling.Name = "cbtraveling"
Me.cbtraveling.Size = New System.Drawing.Size(78, 17)
Me.cbtraveling.TabIndex = 4
Me.cbtraveling.Text = "&Travvelling"
Me.cbtraveling.UseVisualStyleBackColor = True
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(225, 115)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(120, 13)
Me.Label4.TabIndex = 5
Me.Label4.Text = "Total Dues Salesperson"
'
'txtsales
'
Me.txtsales.Location = New System.Drawing.Point(35, 46)
Me.txtsales.Name = "txtsales"
Me.txtsales.Size = New .
1. Explanation:
DesignerCode
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGene
rated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows
Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.cbover = New System.Windows.Forms.CheckBox()
Me.cbtraveling = New System.Windows.Forms.CheckBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtsales = New System.Windows.Forms.TextBox()
Me.txtcommission = New System.Windows.Forms.TextBox()
Me.txtadditional = New System.Windows.Forms.TextBox()
5. Me.btnexit.TabIndex = 11
Me.btnexit.Text = "E&xit"
Me.btnexit.UseVisualStyleBackColor = True
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!,
13.0!)
Me.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(696, 319)
Me.Controls.Add(Me.btnexit)
Me.Controls.Add(Me.btnCalculate)
Me.Controls.Add(Me.txttotaldue)
Me.Controls.Add(Me.txtadditional)
Me.Controls.Add(Me.txtcommission)
Me.Controls.Add(Me.txtsales)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.cbtraveling)
Me.Controls.Add(Me.cbover)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents cbover As
System.Windows.Forms.CheckBox
Friend WithEvents cbtraveling As
System.Windows.Forms.CheckBox
Friend WithEvents Label4 As System.Windows.Forms.Label
6. Friend WithEvents txtsales As System.Windows.Forms.TextBox
Friend WithEvents txtcommission As
System.Windows.Forms.TextBox
Friend WithEvents txtadditional As
System.Windows.Forms.TextBox
Friend WithEvents txttotaldue As
System.Windows.Forms.TextBox
Friend WithEvents btnCalculate As
System.Windows.Forms.Button
Friend WithEvents btnexit As System.Windows.Forms.Button
End Class
Coding
Public Class Form1
Dim comission As Double = 0
Dim additiona As Double = 0
Dim totalDue As Double = 0
Private Sub txtsales_KeyPress(sender As Object, e As
KeyPressEventArgs) Handles txtsales.KeyPress
If e.KeyChar <> ControlChars.Back Then
e.Handled = Not (Char.IsDigit(e.KeyChar) Or e.KeyChar = ".")
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
txtcommission.Enabled = False
txtadditional.Enabled = False
txttotaldue.Enabled = False
txtcommission.Text = String.Format("{0:n}", comission)
'display default
txtadditional.Text = String.Format("{0:n}", additiona) ''display
default
End Sub
Private Sub btnexit_Click(sender As Object, e As EventArgs)
Handles btnexit.Click
End
End Sub
7. Private Sub btnCalculate_Click(sender As Object, e As
EventArgs) Handles btnCalculate.Click
If Val(txtsales.Text) > 0 Then
''calculate additional charge
If cbover.Checked = True And Val(txtsales.Text) < 10000 Then
If cbtraveling.Checked = True Then
additiona = 700
Else
additiona = 500
End If
End If
''calculate commision
If Val(txtsales.Text) > 1 And Val(txtsales.Text) < 5999.99 Then
comission = 0.1 * Val(txtsales.Text)
ElseIf Val(txtsales.Text) > 6000 And Val(txttotaldue.Text) <
29999 Then
comission = 600 + 0.13 * (Val(txtsales.Text) - 6000)
Else
comission = 3720 + 0.14 * (Val(txtsales.Text) - 30000)
End If
End If
totalDue = Val(txtsales.Text) + comission + additiona ''total
calculation
txtcommission.Text = String.Format("{0:n}", comission)
''output display for user
txtadditional.Text = String.Format("{0:n}", additiona) ''output
display for user
txttotaldue.Text = String.Format("{0:n}", totalDue) ''output
display for user
End Sub
End Class