need help on how to code the check box plz

Public Class FerrisForm
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
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
Friend WithEvents IdNumRegLabel As System.Windows.Forms.Label
Friend WithEvents NumRegTextBox As System.Windows.Forms.TextBox
Friend WithEvents Sem1RadioButton As System.Windows.Forms.RadioButton
Friend WithEvents Sem2RadioButton As System.Windows.Forms.RadioButton
Friend WithEvents DiscountCheckBox As System.Windows.Forms.CheckBox
Friend WithEvents CalcButton As System.Windows.Forms.Button
Friend WithEvents ExitButton As System.Windows.Forms.Button
Friend WithEvents IdFeeLabel As System.Windows.Forms.Label
Friend WithEvents TotalFeeLabel As System.Windows.Forms.Label

'Required by the Windows Form Designer
Private components As System.ComponentModel.Container

'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.
Private Sub InitializeComponent()
Me.CalcButton = New System.Windows.Forms.Button
Me.IdNumRegLabel = New System.Windows.Forms.Label
Me.Sem2RadioButton = New System.Windows.Forms.RadioButton
Me.DiscountCheckBox = New System.Windows.Forms.CheckBox
Me.TotalFeeLabel = New System.Windows.Forms.Label
Me.NumRegTextBox = New System.Windows.Forms.TextBox
Me.Sem1RadioButton = New System.Windows.Forms.RadioButton
Me.IdFeeLabel = New System.Windows.Forms.Label
Me.ExitButton = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'CalcButton
'
Me.CalcButton.Location = New System.Drawing.Point(24, 176)
Me.CalcButton.Name = "CalcButton"
Me.CalcButton.Size = New System.Drawing.Size(136, 23)
Me.CalcButton.TabIndex = 5
Me.CalcButton.Text = "&Calculate Total Due"
'
'IdNumRegLabel
'
Me.IdNumRegLabel.AutoSize = True
Me.IdNumRegLabel.Location = New System.Drawing.Point(24, 24)
Me.IdNumRegLabel.Name = "IdNumRegLabel"
Me.IdNumRegLabel.Size = New System.Drawing.Size(120, 19)
Me.IdNumRegLabel.TabIndex = 0
Me.IdNumRegLabel.Text = "&Number registered:"
'
'Sem2RadioButton
'
Me.Sem2RadioButton.Location = New System.Drawing.Point(24, 80)
Me.Sem2RadioButton.Name = "Sem2RadioButton"
Me.Sem2RadioButton.TabIndex = 3
Me.Sem2RadioButton.Text = "Seminar &2"
'
'DiscountCheckBox
'
Me.DiscountCheckBox.Location = New System.Drawing.Point(144, 56)
Me.DiscountCheckBox.Name = "DiscountCheckBox"
Me.DiscountCheckBox.Size = New System.Drawing.Size(88, 24)
Me.DiscountCheckBox.TabIndex = 4
Me.DiscountCheckBox.Text = "&Discount"
'
'TotalFeeLabel
'
Me.TotalFeeLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TotalFeeLabel.Location = New System.Drawing.Point(128, 112)
Me.TotalFeeLabel.Name = "TotalFeeLabel"
Me.TotalFeeLabel.Size = New System.Drawing.Size(104, 23)
Me.TotalFeeLabel.TabIndex = 8
Me.TotalFeeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'NumRegTextBox
'
Me.NumRegTextBox.Location = New System.Drawing.Point(144, 24)
Me.NumRegTextBox.Name = "NumRegTextBox"
Me.NumRegTextBox.Size = New System.Drawing.Size(88, 23)
Me.NumRegTextBox.TabIndex = 1
Me.NumRegTextBox.Text = ""
'
'Sem1RadioButton
'
Me.Sem1RadioButton.Checked = True
Me.Sem1RadioButton.Location = New System.Drawing.Point(24, 56)
Me.Sem1RadioButton.Name = "Sem1RadioButton"
Me.Sem1RadioButton.TabIndex = 2
Me.Sem1RadioButton.TabStop = True
Me.Sem1RadioButton.Text = "Seminar &1"
'
'IdFeeLabel
'
Me.IdFeeLabel.AutoSize = True
Me.IdFeeLabel.Location = New System.Drawing.Point(24, 112)
Me.IdFeeLabel.Name = "IdFeeLabel"
Me.IdFeeLabel.Size = New System.Drawing.Size(103, 19)
Me.IdFeeLabel.TabIndex = 7
Me.IdFeeLabel.Text = "Registration fee:"
'
'ExitButton
'
Me.ExitButton.Location = New System.Drawing.Point(168, 176)
Me.ExitButton.Name = "ExitButton"
Me.ExitButton.TabIndex = 6
Me.ExitButton.Text = "E&xit"
'
'FerrisForm
'
Me.AcceptButton = Me.CalcButton
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 16)
Me.ClientSize = New System.Drawing.Size(272, 221)
Me.Controls.Add(Me.TotalFeeLabel)
Me.Controls.Add(Me.IdFeeLabel)
Me.Controls.Add(Me.ExitButton)
Me.Controls.Add(Me.CalcButton)
Me.Controls.Add(Me.DiscountCheckBox)
Me.Controls.Add(Me.Sem2RadioButton)
Me.Controls.Add(Me.Sem1RadioButton)
Me.Controls.Add(Me.NumRegTextBox)
Me.Controls.Add(Me.IdNumRegLabel)
Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MaximizeBox = False
Me.Name = "FerrisForm"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Ferris Seminars"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub ExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Me.Close()
End Sub

Private Sub NumRegTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumRegTextBox.TextChanged

End Sub

Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click
Dim firstsemprice As Integer
Dim secondsemprice As Integer
firstsemprice = 100
secondsemprice = 120
If Me.Sem1RadioButton.Checked = True Then
'do something
TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 100
Else 'Sem2RadioButton.Checked = True
'do something
TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 120
'total fee = number of persons * price
'TotalFeeLabel=numregtextbox.text * secondsemprice
'TotalFeeLabel=numregtextbox.text * firstsemprice
'DiscountCheckBox = 10%
'If DiscountCheckBox.Checked = True Then
'TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 100 * 0.1
'If DiscountCheckBox.Checked = True Then
'TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 120 * 0.1
End If
'End If
'End If
End Sub

Private Sub TotalFeeLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalFeeLabel.Click

End Sub

Private Sub Sem1RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sem1RadioButton.CheckedChanged

End Sub

Private Sub Sem2RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sem2RadioButton.CheckedChanged

End Sub

Private Sub DiscountCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiscountCheckBox.CheckedChanged

End Sub
End Class

Jakob Mall

Comments

  • : Public Class FerrisForm
    : Inherits System.Windows.Forms.Form
    :
    : #Region " Windows Form Designer generated code "
    :
    : Public Sub New()
    : MyBase.New()
    :
    : 'This call is required by the Windows Form Designer.
    : InitializeComponent()
    :
    : 'Add any initialization after the InitializeComponent() call
    :
    : End Sub
    :
    : 'Form overrides dispose to clean up the component list.
    : 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
    : Friend WithEvents IdNumRegLabel As System.Windows.Forms.Label
    : Friend WithEvents NumRegTextBox As System.Windows.Forms.TextBox
    : Friend WithEvents Sem1RadioButton As System.Windows.Forms.RadioButton
    : Friend WithEvents Sem2RadioButton As System.Windows.Forms.RadioButton
    : Friend WithEvents DiscountCheckBox As System.Windows.Forms.CheckBox
    : Friend WithEvents CalcButton As System.Windows.Forms.Button
    : Friend WithEvents ExitButton As System.Windows.Forms.Button
    : Friend WithEvents IdFeeLabel As System.Windows.Forms.Label
    : Friend WithEvents TotalFeeLabel As System.Windows.Forms.Label
    :
    : 'Required by the Windows Form Designer
    : Private components As System.ComponentModel.Container
    :
    : '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.
    : Private Sub InitializeComponent()
    : Me.CalcButton = New System.Windows.Forms.Button
    : Me.IdNumRegLabel = New System.Windows.Forms.Label
    : Me.Sem2RadioButton = New System.Windows.Forms.RadioButton
    : Me.DiscountCheckBox = New System.Windows.Forms.CheckBox
    : Me.TotalFeeLabel = New System.Windows.Forms.Label
    : Me.NumRegTextBox = New System.Windows.Forms.TextBox
    : Me.Sem1RadioButton = New System.Windows.Forms.RadioButton
    : Me.IdFeeLabel = New System.Windows.Forms.Label
    : Me.ExitButton = New System.Windows.Forms.Button
    : Me.SuspendLayout()
    : '
    : 'CalcButton
    : '
    : Me.CalcButton.Location = New System.Drawing.Point(24, 176)
    : Me.CalcButton.Name = "CalcButton"
    : Me.CalcButton.Size = New System.Drawing.Size(136, 23)
    : Me.CalcButton.TabIndex = 5
    : Me.CalcButton.Text = "&Calculate Total Due"
    : '
    : 'IdNumRegLabel
    : '
    : Me.IdNumRegLabel.AutoSize = True
    : Me.IdNumRegLabel.Location = New System.Drawing.Point(24, 24)
    : Me.IdNumRegLabel.Name = "IdNumRegLabel"
    : Me.IdNumRegLabel.Size = New System.Drawing.Size(120, 19)
    : Me.IdNumRegLabel.TabIndex = 0
    : Me.IdNumRegLabel.Text = "&Number registered:"
    : '
    : 'Sem2RadioButton
    : '
    : Me.Sem2RadioButton.Location = New System.Drawing.Point(24, 80)
    : Me.Sem2RadioButton.Name = "Sem2RadioButton"
    : Me.Sem2RadioButton.TabIndex = 3
    : Me.Sem2RadioButton.Text = "Seminar &2"
    : '
    : 'DiscountCheckBox
    : '
    : Me.DiscountCheckBox.Location = New System.Drawing.Point(144, 56)
    : Me.DiscountCheckBox.Name = "DiscountCheckBox"
    : Me.DiscountCheckBox.Size = New System.Drawing.Size(88, 24)
    : Me.DiscountCheckBox.TabIndex = 4
    : Me.DiscountCheckBox.Text = "&Discount"
    : '
    : 'TotalFeeLabel
    : '
    : Me.TotalFeeLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
    : Me.TotalFeeLabel.Location = New System.Drawing.Point(128, 112)
    : Me.TotalFeeLabel.Name = "TotalFeeLabel"
    : Me.TotalFeeLabel.Size = New System.Drawing.Size(104, 23)
    : Me.TotalFeeLabel.TabIndex = 8
    : Me.TotalFeeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    : '
    : 'NumRegTextBox
    : '
    : Me.NumRegTextBox.Location = New System.Drawing.Point(144, 24)
    : Me.NumRegTextBox.Name = "NumRegTextBox"
    : Me.NumRegTextBox.Size = New System.Drawing.Size(88, 23)
    : Me.NumRegTextBox.TabIndex = 1
    : Me.NumRegTextBox.Text = ""
    : '
    : 'Sem1RadioButton
    : '
    : Me.Sem1RadioButton.Checked = True
    : Me.Sem1RadioButton.Location = New System.Drawing.Point(24, 56)
    : Me.Sem1RadioButton.Name = "Sem1RadioButton"
    : Me.Sem1RadioButton.TabIndex = 2
    : Me.Sem1RadioButton.TabStop = True
    : Me.Sem1RadioButton.Text = "Seminar &1"
    : '
    : 'IdFeeLabel
    : '
    : Me.IdFeeLabel.AutoSize = True
    : Me.IdFeeLabel.Location = New System.Drawing.Point(24, 112)
    : Me.IdFeeLabel.Name = "IdFeeLabel"
    : Me.IdFeeLabel.Size = New System.Drawing.Size(103, 19)
    : Me.IdFeeLabel.TabIndex = 7
    : Me.IdFeeLabel.Text = "Registration fee:"
    : '
    : 'ExitButton
    : '
    : Me.ExitButton.Location = New System.Drawing.Point(168, 176)
    : Me.ExitButton.Name = "ExitButton"
    : Me.ExitButton.TabIndex = 6
    : Me.ExitButton.Text = "E&xit"
    : '
    : 'FerrisForm
    : '
    : Me.AcceptButton = Me.CalcButton
    : Me.AutoScaleBaseSize = New System.Drawing.Size(6, 16)
    : Me.ClientSize = New System.Drawing.Size(272, 221)
    : Me.Controls.Add(Me.TotalFeeLabel)
    : Me.Controls.Add(Me.IdFeeLabel)
    : Me.Controls.Add(Me.ExitButton)
    : Me.Controls.Add(Me.CalcButton)
    : Me.Controls.Add(Me.DiscountCheckBox)
    : Me.Controls.Add(Me.Sem2RadioButton)
    : Me.Controls.Add(Me.Sem1RadioButton)
    : Me.Controls.Add(Me.NumRegTextBox)
    : Me.Controls.Add(Me.IdNumRegLabel)
    : Me.Font = New System.Drawing.Font("Tahoma", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    : Me.MaximizeBox = False
    : Me.Name = "FerrisForm"
    : Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    : Me.Text = "Ferris Seminars"
    : Me.ResumeLayout(False)
    :
    : End Sub
    :
    : #End Region
    :
    : Private Sub ExitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitButton.Click
    : Me.Close()
    : End Sub
    :
    : Private Sub NumRegTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumRegTextBox.TextChanged
    :
    : End Sub
    :
    : Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click
    : Dim firstsemprice As Integer
    : Dim secondsemprice As Integer
    : firstsemprice = 100
    : secondsemprice = 120
    : If Me.Sem1RadioButton.Checked = True Then
    : 'do something
    : TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 100
    : Else 'Sem2RadioButton.Checked = True
    : 'do something
    : TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 120
    : 'total fee = number of persons * price
    : 'TotalFeeLabel=numregtextbox.text * secondsemprice
    : 'TotalFeeLabel=numregtextbox.text * firstsemprice
    : 'DiscountCheckBox = 10%
    : 'If DiscountCheckBox.Checked = True Then
    : 'TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 100 * 0.1
    : 'If DiscountCheckBox.Checked = True Then
    : 'TotalFeeLabel.Text = Val(Me.NumRegTextBox.Text) * 120 * 0.1
    : End If
    : 'End If
    : 'End If
    : End Sub
    :
    : Private Sub TotalFeeLabel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalFeeLabel.Click
    :
    : End Sub
    :
    : Private Sub Sem1RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sem1RadioButton.CheckedChanged
    :
    : End Sub
    :
    : Private Sub Sem2RadioButton_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Sem2RadioButton.CheckedChanged
    :
    : End Sub
    :
    : Private Sub DiscountCheckBox_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiscountCheckBox.CheckedChanged
    :
    : End Sub
    : End Class
    :
    : Jakob Mall
    :
    [red]****************************************************************[/red]

    [blue] Just make this change and delete the Sub Procedure[/blue]

    [code]Private Sub CalcButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalcButton.Click[red], DiscountCheckBox.CheckedChanged[/red][/code]

    [blue]When the checked box is checked then it fires the CalcButton.Click event[/blue]

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion