Option Explicit On 
Option Strict On

Public Class frmCustomer
  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 Label1 As System.Windows.Forms.Label
  Friend WithEvents txtName As System.Windows.Forms.TextBox
  Friend WithEvents Label2 As System.Windows.Forms.Label
  Friend WithEvents txtAge As System.Windows.Forms.TextBox
  Friend WithEvents grpSex As System.Windows.Forms.GroupBox
  Friend WithEvents rdoMale As System.Windows.Forms.RadioButton
  Friend WithEvents rdoFemale As System.Windows.Forms.RadioButton
  Friend WithEvents grpLevel As System.Windows.Forms.GroupBox
  Friend WithEvents grpActivities As System.Windows.Forms.GroupBox
  Friend WithEvents grpCity As System.Windows.Forms.GroupBox
  Friend WithEvents cboCity As System.Windows.Forms.ComboBox
  Friend WithEvents btnShow As System.Windows.Forms.Button
  Friend WithEvents btnNew As System.Windows.Forms.Button
  Friend WithEvents btnExit As System.Windows.Forms.Button
  Friend WithEvents chkSkate As System.Windows.Forms.CheckBox
  Friend WithEvents chkSki As System.Windows.Forms.CheckBox
  Friend WithEvents chkSwim As System.Windows.Forms.CheckBox
  Friend WithEvents chkBike As System.Windows.Forms.CheckBox
  Friend WithEvents chkWalk As System.Windows.Forms.CheckBox
  Friend WithEvents chkRun As System.Windows.Forms.CheckBox
  Friend WithEvents rdoBeginner As System.Windows.Forms.RadioButton
  Friend WithEvents rdoIntermediate As System.Windows.Forms.RadioButton
  Friend WithEvents rdoAdvanced As System.Windows.Forms.RadioButton
  Friend WithEvents rdoExtreme As System.Windows.Forms.RadioButton

  '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.
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.chkSkate = New System.Windows.Forms.CheckBox()
    Me.rdoBeginner = New System.Windows.Forms.RadioButton()
    Me.rdoMale = New System.Windows.Forms.RadioButton()
    Me.Label2 = New System.Windows.Forms.Label()
    Me.grpCity = New System.Windows.Forms.GroupBox()
    Me.cboCity = New System.Windows.Forms.ComboBox()
    Me.grpActivities = New System.Windows.Forms.GroupBox()
    Me.chkSki = New System.Windows.Forms.CheckBox()
    Me.chkSwim = New System.Windows.Forms.CheckBox()
    Me.chkBike = New System.Windows.Forms.CheckBox()
    Me.chkWalk = New System.Windows.Forms.CheckBox()
    Me.chkRun = New System.Windows.Forms.CheckBox()
    Me.rdoIntermediate = New System.Windows.Forms.RadioButton()
    Me.btnNew = New System.Windows.Forms.Button()
    Me.txtAge = New System.Windows.Forms.TextBox()
    Me.rdoFemale = New System.Windows.Forms.RadioButton()
    Me.txtName = New System.Windows.Forms.TextBox()
    Me.rdoExtreme = New System.Windows.Forms.RadioButton()
    Me.grpLevel = New System.Windows.Forms.GroupBox()
    Me.rdoAdvanced = New System.Windows.Forms.RadioButton()
    Me.btnExit = New System.Windows.Forms.Button()
    Me.btnShow = New System.Windows.Forms.Button()
    Me.grpSex = New System.Windows.Forms.GroupBox()
    Me.grpCity.SuspendLayout()
    Me.grpActivities.SuspendLayout()
    Me.grpLevel.SuspendLayout()
    Me.grpSex.SuspendLayout()
    Me.SuspendLayout()
    '
    'Label1
    '
    Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.Label1.Location = New System.Drawing.Point(8, 16)
    Me.Label1.Name = "Label1"
    Me.Label1.TabIndex = 0
    Me.Label1.Text = "Name"
    '
    'chkSkate
    '
    Me.chkSkate.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkSkate.Location = New System.Drawing.Point(16, 144)
    Me.chkSkate.Name = "chkSkate"
    Me.chkSkate.TabIndex = 0
    Me.chkSkate.Text = "In-Line Skating"
    '
    'rdoBeginner
    '
    Me.rdoBeginner.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoBeginner.Location = New System.Drawing.Point(16, 96)
    Me.rdoBeginner.Name = "rdoBeginner"
    Me.rdoBeginner.Size = New System.Drawing.Size(96, 24)
    Me.rdoBeginner.TabIndex = 0
    Me.rdoBeginner.Text = "Beginner"
    '
    'rdoMale
    '
    Me.rdoMale.Checked = True
    Me.rdoMale.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoMale.Location = New System.Drawing.Point(16, 24)
    Me.rdoMale.Name = "rdoMale"
    Me.rdoMale.Size = New System.Drawing.Size(96, 24)
    Me.rdoMale.TabIndex = 0
    Me.rdoMale.TabStop = True
    Me.rdoMale.Text = "Male"
    '
    'Label2
    '
    Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.Label2.Location = New System.Drawing.Point(264, 16)
    Me.Label2.Name = "Label2"
    Me.Label2.TabIndex = 0
    Me.Label2.Text = "Age"
    '
    'grpCity
    '
    Me.grpCity.Controls.AddRange(New System.Windows.Forms.Control() {Me.cboCity})
    Me.grpCity.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.grpCity.Location = New System.Drawing.Point(144, 40)
    Me.grpCity.Name = "grpCity"
    Me.grpCity.Size = New System.Drawing.Size(136, 136)
    Me.grpCity.TabIndex = 4
    Me.grpCity.TabStop = False
    Me.grpCity.Text = "City of Residence"
    '
    'cboCity
    '
    Me.cboCity.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple
    Me.cboCity.DropDownWidth = 120
    Me.cboCity.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.cboCity.Location = New System.Drawing.Point(8, 24)
    Me.cboCity.Name = "cboCity"
    Me.cboCity.Size = New System.Drawing.Size(120, 104)
    Me.cboCity.Sorted = True
    Me.cboCity.TabIndex = 0
    '
    'grpActivities
    '
    Me.grpActivities.Controls.AddRange(New System.Windows.Forms.Control() {Me.chkSkate, Me.chkSki, Me.chkSwim, Me.chkBike, Me.chkWalk, Me.chkRun})
    Me.grpActivities.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.grpActivities.Location = New System.Drawing.Point(8, 128)
    Me.grpActivities.Name = "grpActivities"
    Me.grpActivities.Size = New System.Drawing.Size(128, 176)
    Me.grpActivities.TabIndex = 3
    Me.grpActivities.TabStop = False
    Me.grpActivities.Text = "Activities"
    '
    'chkSki
    '
    Me.chkSki.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkSki.Location = New System.Drawing.Point(16, 120)
    Me.chkSki.Name = "chkSki"
    Me.chkSki.Size = New System.Drawing.Size(96, 24)
    Me.chkSki.TabIndex = 0
    Me.chkSki.Text = "Skiing"
    '
    'chkSwim
    '
    Me.chkSwim.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkSwim.Location = New System.Drawing.Point(16, 96)
    Me.chkSwim.Name = "chkSwim"
    Me.chkSwim.Size = New System.Drawing.Size(96, 24)
    Me.chkSwim.TabIndex = 0
    Me.chkSwim.Text = "Swimming"
    '
    'chkBike
    '
    Me.chkBike.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkBike.Location = New System.Drawing.Point(16, 72)
    Me.chkBike.Name = "chkBike"
    Me.chkBike.Size = New System.Drawing.Size(96, 24)
    Me.chkBike.TabIndex = 0
    Me.chkBike.Text = "Biking"
    '
    'chkWalk
    '
    Me.chkWalk.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkWalk.Location = New System.Drawing.Point(16, 48)
    Me.chkWalk.Name = "chkWalk"
    Me.chkWalk.Size = New System.Drawing.Size(96, 24)
    Me.chkWalk.TabIndex = 0
    Me.chkWalk.Text = "Walking"
    '
    'chkRun
    '
    Me.chkRun.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.chkRun.Location = New System.Drawing.Point(16, 24)
    Me.chkRun.Name = "chkRun"
    Me.chkRun.Size = New System.Drawing.Size(96, 24)
    Me.chkRun.TabIndex = 0
    Me.chkRun.Text = "Running"
    '
    'rdoIntermediate
    '
    Me.rdoIntermediate.Checked = True
    Me.rdoIntermediate.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoIntermediate.Location = New System.Drawing.Point(16, 72)
    Me.rdoIntermediate.Name = "rdoIntermediate"
    Me.rdoIntermediate.TabIndex = 0
    Me.rdoIntermediate.TabStop = True
    Me.rdoIntermediate.Text = "Intermediate"
    '
    'btnNew
    '
    Me.btnNew.Location = New System.Drawing.Point(288, 224)
    Me.btnNew.Name = "btnNew"
    Me.btnNew.Size = New System.Drawing.Size(96, 32)
    Me.btnNew.TabIndex = 7
    Me.btnNew.Text = "&New Profile"
    '
    'txtAge
    '
    Me.txtAge.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.txtAge.Location = New System.Drawing.Point(304, 8)
    Me.txtAge.Name = "txtAge"
    Me.txtAge.Size = New System.Drawing.Size(64, 26)
    Me.txtAge.TabIndex = 1
    Me.txtAge.Text = ""
    '
    'rdoFemale
    '
    Me.rdoFemale.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoFemale.Location = New System.Drawing.Point(16, 48)
    Me.rdoFemale.Name = "rdoFemale"
    Me.rdoFemale.Size = New System.Drawing.Size(96, 24)
    Me.rdoFemale.TabIndex = 0
    Me.rdoFemale.Text = "Female"
    '
    'txtName
    '
    Me.txtName.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.txtName.Location = New System.Drawing.Point(64, 8)
    Me.txtName.Name = "txtName"
    Me.txtName.Size = New System.Drawing.Size(184, 26)
    Me.txtName.TabIndex = 0
    Me.txtName.Text = ""
    '
    'rdoExtreme
    '
    Me.rdoExtreme.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoExtreme.Location = New System.Drawing.Point(16, 24)
    Me.rdoExtreme.Name = "rdoExtreme"
    Me.rdoExtreme.Size = New System.Drawing.Size(96, 24)
    Me.rdoExtreme.TabIndex = 0
    Me.rdoExtreme.Text = "Extreme"
    '
    'grpLevel
    '
    Me.grpLevel.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoBeginner, Me.rdoIntermediate, Me.rdoAdvanced, Me.rdoExtreme})
    Me.grpLevel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.grpLevel.Location = New System.Drawing.Point(144, 176)
    Me.grpLevel.Name = "grpLevel"
    Me.grpLevel.Size = New System.Drawing.Size(136, 128)
    Me.grpLevel.TabIndex = 5
    Me.grpLevel.TabStop = False
    Me.grpLevel.Text = "Athletic Level"
    '
    'rdoAdvanced
    '
    Me.rdoAdvanced.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.rdoAdvanced.Location = New System.Drawing.Point(16, 48)
    Me.rdoAdvanced.Name = "rdoAdvanced"
    Me.rdoAdvanced.Size = New System.Drawing.Size(96, 24)
    Me.rdoAdvanced.TabIndex = 0
    Me.rdoAdvanced.Text = "Advanced"
    '
    'btnExit
    '
    Me.btnExit.Location = New System.Drawing.Point(288, 264)
    Me.btnExit.Name = "btnExit"
    Me.btnExit.Size = New System.Drawing.Size(96, 32)
    Me.btnExit.TabIndex = 8
    Me.btnExit.Text = "E&xit"
    '
    'btnShow
    '
    Me.btnShow.Location = New System.Drawing.Point(288, 184)
    Me.btnShow.Name = "btnShow"
    Me.btnShow.Size = New System.Drawing.Size(96, 32)
    Me.btnShow.TabIndex = 6
    Me.btnShow.Text = "&Show Profile"
    '
    'grpSex
    '
    Me.grpSex.Controls.AddRange(New System.Windows.Forms.Control() {Me.rdoFemale, Me.rdoMale})
    Me.grpSex.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, (System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.grpSex.Location = New System.Drawing.Point(8, 40)
    Me.grpSex.Name = "grpSex"
    Me.grpSex.Size = New System.Drawing.Size(128, 80)
    Me.grpSex.TabIndex = 2
    Me.grpSex.TabStop = False
    Me.grpSex.Text = "Sex"
    '
    'frmCustomer
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.BackColor = System.Drawing.Color.LightGray
    Me.ClientSize = New System.Drawing.Size(398, 327)
    Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnExit, Me.btnNew, Me.btnShow, Me.grpCity, Me.grpActivities, Me.grpLevel, Me.grpSex, Me.txtAge, Me.Label2, Me.txtName, Me.Label1})
    Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
    Me.Name = "frmCustomer"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    Me.Text = "Customer Profile"
    Me.grpCity.ResumeLayout(False)
    Me.grpActivities.ResumeLayout(False)
    Me.grpLevel.ResumeLayout(False)
    Me.grpSex.ResumeLayout(False)
    Me.ResumeLayout(False)

  End Sub

#End Region

  Dim AthleticLevel As String
  Dim Activity(6) As CheckBox

  Private Sub frmCustomer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Load combo box with potential city names
    cboCity.Items.Add("Seattle")
    cboCity.Text = "Seattle"
    cboCity.Items.Add("Bellevue")
    cboCity.Items.Add("Kirkland")
    cboCity.Items.Add("Everett")
    cboCity.Items.Add("Mercer Island")
    cboCity.Items.Add("Renton")
    cboCity.Items.Add("Issaquah")
    cboCity.Items.Add("Kent")
    cboCity.Items.Add("Bothell")
    cboCity.Items.Add("Tukwila")
    cboCity.Items.Add("West Seattle")
    cboCity.Items.Add("Edmonds")
    cboCity.Items.Add("Tacoma")
    cboCity.Items.Add("Federal Way")
    cboCity.Items.Add("Burien")
    cboCity.Items.Add("SeaTac")
    cboCity.Items.Add("Woodinville")
    AthleticLevel = "Intermediate"
    'check box array
    Activity(1) = chkRun
    Activity(2) = chkWalk
    Activity(3) = chkBike
    Activity(4) = chkSwim
    Activity(5) = chkSki
    Activity(6) = chkSkate
  End Sub


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

  Private Sub btnNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNew.Click
    'Blank out name and reset check boxes
    Dim I As Integer
    txtName.Text = ""
    txtAge.Text = ""
    chkRun.Checked = False
    chkWalk.Checked = False
    chkBike.Checked = False
    chkSwim.Checked = False
    chkSki.Checked = False
    chkSkate.Checked = False
    txtName.Focus()
  End Sub

  Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
    Dim Msg As String, Pronoun As String
    Dim ActMsg As String
    Dim I As Integer
    'Check to make sure name entered
    If txtName.Text = "" Then
      MessageBox.Show("The profile requires a name.", "No Name Entered", MessageBoxButtons.OK, MessageBoxIcon.Error)
      txtName.Focus()
      Exit Sub
    End If
    'Check to make sure age entered
    If txtAge.Text = "" Then
      MessageBox.Show("The profile requires an age.", "No Age Entered", MessageBoxButtons.OK, MessageBoxIcon.Error)
      txtAge.Focus()
      Exit Sub
    End If
    'Put together customer profile message
    Msg = txtName.Text + " is " + txtAge.Text + " years old." + ControlChars.Cr
    If rdoMale.Checked Then
      Pronoun = "He "
    Else
      Pronoun = "She "
    End If
    Msg += Pronoun + "lives in " + cboCity.Text + "." + ControlChars.Cr
    Msg += Pronoun + "is a"
    If Not (rdoBeginner.Checked) Then
      Msg += "n "
    Else
      Msg += " "
    End If
    Msg += LCase(AthleticLevel) + " level athlete." + ControlChars.Cr
    ActMsg = ""
    'add activities (if any)
    For I = 1 To 6
      If Activity(I).Checked Then
        ActMsg += "     " + Activity(I).Text + ControlChars.Cr
      End If
    Next I
    If ActMsg <> "" Then
      Msg += "Activities include:" + ControlChars.Cr + ActMsg
    Else
      Msg += ControlChars.Cr
    End If
    MessageBox.Show(Msg, "Customer Profile", MessageBoxButtons.OK)
  End Sub

  Private Sub txtAge_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtAge.KeyPress
    'Only allow numbers for age
    Select Case e.KeyChar
      Case CChar("0") To CChar("9"), ControlChars.Back
        'keystroke ok
        e.Handled = False
      Case Else
        e.Handled = True
    End Select
  End Sub

  Private Sub rdoLevel_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoBeginner.CheckedChanged, rdoIntermediate.CheckedChanged, rdoAdvanced.CheckedChanged, rdoExtreme.CheckedChanged
    Dim rdoLevel As RadioButton
    'Determine which button was clicked and change level
    rdoLevel = CType(sender, RadioButton)
    AthleticLevel = rdoLevel.Text
  End Sub


End Class
