Public Class Form1
    Inherits System.Windows.Forms.Form

    ' enum...
    Public Enum DayAction As Integer
        Asleep = 0
        GettingReadyForWork = 1
        TravelingToWork = 2
        AtWork = 3
        AtLunch = 4
        TravelingFromWork = 5
        RelaxingWithFriends = 6
        GettingReadyForBed = 7
    End Enum

    ' members...
    Public CurrentState As DayAction


#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 trkHour As System.Windows.Forms.TrackBar
    Friend WithEvents txtState As System.Windows.Forms.TextBox

    '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.trkHour = New System.Windows.Forms.TrackBar()
        Me.txtState = New System.Windows.Forms.TextBox()
        CType(Me.trkHour, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'trkHour
        '
        Me.trkHour.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.trkHour.Location = New System.Drawing.Point(8, 12)
        Me.trkHour.Maximum = 23
        Me.trkHour.Name = "trkHour"
        Me.trkHour.Size = New System.Drawing.Size(268, 42)
        Me.trkHour.TabIndex = 0
        '
        'txtState
        '
        Me.txtState.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.txtState.Location = New System.Drawing.Point(8, 64)
        Me.txtState.Name = "txtState"
        Me.txtState.Size = New System.Drawing.Size(268, 20)
        Me.txtState.TabIndex = 1
        Me.txtState.Text = ""
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(284, 97)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtState, Me.trkHour})
        Me.Name = "Form1"
        Me.Text = "What's Len Doing?"
        CType(Me.trkHour, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)

    End Sub

#End Region



    
  

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        ' set the hour to the current hour...
        Me.Hour = Date.Now.Hour

    End Sub

    ' Hour property...
    Public Property Hour() As Integer
        Get
            Return trkHour.Value
        End Get
        Set(ByVal Value As Integer)

            ' set the hour...
            trkHour.Value = Value

            ' determine the state...
            Dim hour As Integer = Value
            If hour >= 6 And hour < 7 Then
                CurrentState = DayAction.TravelingToWork
            ElseIf hour >= 7 And hour < 8 Then
                CurrentState = DayAction.TravelingToWork
            ElseIf hour >= 8 And hour < 13 Then
                CurrentState = DayAction.AtWork
            ElseIf hour >= 13 And hour < 14 Then
                CurrentState = DayAction.AtLunch
            ElseIf hour >= 14 And hour < 17 Then
                CurrentState = DayAction.AtWork
            ElseIf hour >= 17 And hour < 18 Then
                CurrentState = DayAction.TravelingFromWork
            ElseIf hour >= 18 And hour < 22 Then
                CurrentState = DayAction.RelaxingWithFriends
            ElseIf hour >= 22 And hour < 23 Then
                CurrentState = DayAction.GettingReadyForBed
            Else
                CurrentState = DayAction.Asleep
            End If

            ' set the text...
            Dim statusText As String
            statusText = "At " & Value & ":00, Len is " & _
    CurrentState.ToString()


            ' update the display...
            txtState.Text = statusText

        End Set
    End Property


    Private Sub trkHour_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trkHour.Scroll

        ' update the hour...
        Me.Hour = trkHour.Value

    End Sub

End Class
