Results 1 to 28 of 28

Thread: Make Label Format Time 9:59:59

  1. #1

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Question Make Label Format Time 9:59:59

    Hello. I am doing some work for a visual basic class and needed a little help. We are designing the GUI of a microwave where a user can hit the numeric buttons 0-9 and create the time they want their item to cook. I have everything complete and ready to be submitted, but the only thing left is getting the label that displays the entered time to look like it is in a clock format.

    Right now you enter the digits and it puts them like this: 95959

    I am trying to get it to always enter it like this: 9:59:59

    Any help with a code would be awesome! Thanks!

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Make Label Format Time 9:59:59

    This looks to be a simple issue but your code is required here.

    How do you want your time to be set, from left to right or from right to left?

    What i mean is:

    9:00:00 -> 9:50:00 -> 9:59:00 -> 9:59:50 -> 9:59:59

    or

    0:00:09 -> 0:00:95 -> 0:09:59 -> 0:95:95 -> 9:59:59

    Well, the second variant seems not like a good idea

  3. #3
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,493

    Re: Make Label Format Time 9:59:59

    What about 24 hour time format?

    1:20:20 is not the same as 13:20:20
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  4. #4
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Make Label Format Time 9:59:59

    From what I understand he's doing a sample interface for a microwave oven. I doubt anyone would set his microwave for 13+ hours

  5. #5

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Here is my Code:

    vb Code:
    1. Option Strict On
    2.  
    3. Public Class Form1
    4.  
    5.     Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
    6.         lblYellow.Show()
    7.         lblGray.Hide()
    8.         lblClock.Hide()
    9.         lblTime.Show()
    10.         Timer1.Enabled = True
    11.         Beep()
    12.     End Sub
    13.  
    14.     Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
    15.         lblYellow.Hide()
    16.         lblGray.Show()
    17.         lblClock.Show()
    18.         lblTime.Text = ""
    19.         lblTime.Hide()
    20.         Timer1.Enabled = False
    21.         Beep()
    22.     End Sub
    23.  
    24.     Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
    25.         lblYellow.Hide()
    26.         lblGray.Show()
    27.         If lblTime.Text > "0" Then
    28.             lblClock.Hide()
    29.         End If
    30.         If lblTime.Text = "DONE" Then
    31.             lblTime.Hide()
    32.             lblClock.Show()
    33.             lblTime.Text = ""
    34.         End If
    35.         Timer1.Enabled = False
    36.         Beep()
    37.     End Sub
    38.  
    39.     Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
    40.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn1.Text
    41.         Beep()
    42.         lblClock.Hide()
    43.         lblTime.Show()
    44.     End Sub
    45.  
    46.     Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
    47.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn2.Text
    48.         Beep()
    49.         lblClock.Hide()
    50.         lblTime.Show()
    51.     End Sub
    52.  
    53.     Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
    54.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn3.Text
    55.         Beep()
    56.         lblClock.Hide()
    57.         lblTime.Show()
    58.     End Sub
    59.  
    60.     Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
    61.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn4.Text
    62.         Beep()
    63.         lblClock.Hide()
    64.         lblTime.Show()
    65.     End Sub
    66.  
    67.     Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
    68.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn5.Text
    69.         Beep()
    70.         lblClock.Hide()
    71.         lblTime.Show()
    72.     End Sub
    73.  
    74.     Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
    75.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn6.Text
    76.         Beep()
    77.         lblClock.Hide()
    78.         lblTime.Show()
    79.     End Sub
    80.  
    81.     Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
    82.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn7.Text
    83.         Beep()
    84.         lblClock.Hide()
    85.         lblTime.Show()
    86.     End Sub
    87.  
    88.     Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
    89.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn8.Text
    90.         Beep()
    91.         lblClock.Hide()
    92.         lblTime.Show()
    93.     End Sub
    94.  
    95.     Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
    96.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn9.Text
    97.         Beep()
    98.         lblClock.Hide()
    99.         lblTime.Show()
    100.     End Sub
    101.  
    102.     Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
    103.         If lblTime.Text.Length >= 0 Then lblTime.Text += btn0.Text
    104.         Beep()
    105.         lblClock.Hide()
    106.         lblTime.Show()
    107.     End Sub
    108.  
    109.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    110.         Dim A As Integer
    111.         Dim B As Integer
    112.  
    113.         If lblTime.Text > "0" Then
    114.             Timer1.Enabled = True
    115.             A = CInt(lblTime.Text)
    116.             B = 1
    117.  
    118.             lblTime.Text = CStr(A - B)
    119.         ElseIf lblTime.Text = "" Then
    120.             Timer1.Enabled = False
    121.         End If
    122.         If lblTime.Text = "0" Then
    123.             Beep()
    124.             lblTime.Text = "DONE"
    125.             Timer1.Enabled = False
    126.             lblYellow.Hide()
    127.             lblGray.Show()
    128.         End If
    129.         If lblTime.Text = "" Then
    130.             Timer1.Enabled = False
    131.             lblYellow.Hide()
    132.             lblGray.Show()
    133.         End If
    134.     End Sub
    135.  
    136.     Private Sub btnClock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClock.Click
    137.         If lblTime.Text = "" Or Timer1.Enabled = False Then
    138.             lblClock.Show()
    139.             lblTime.Hide()
    140.             lblYellow.Hide()
    141.             lblGray.Show()
    142.             Timer2.Enabled = True
    143.             Timer1.Enabled = False
    144.         End If
    145.         Beep()
    146.     End Sub
    147.  
    148.     Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    149.         lblClock.Text = CStr(TimeOfDay)
    150.     End Sub
    151. End Class

    I want it to be in the format you listed: "0:00:09 -> 0:00:95 -> 0:09:59 -> 0:95:95 -> 9:59:59"

    Just like you would have the cook time appear when you typed it in on your own microwave at home.

    The max is 9 hours, 59 min, 59 sec.

  6. #6
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Make Label Format Time 9:59:59

    Try this. Set your form's KeyPreview property to True and drop a Label to it (named Label1) then paste this code in. Now run it and try to type some values using the keyboard.
    Code:
     Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
            Dim curTxt As String = Label1.Text.Replace(":", "")
            If curTxt.Length < 6 Then
                Dim ch As Char = e.KeyChar
                If Char.IsNumber(ch) Then
                    curTxt &= ch
                    If curTxt.Length > 2 Then
                        For i As Integer = curTxt.Length - 2 To 1 Step -2
                            curTxt = curTxt.Insert(i, ":")
                        Next
                    End If
                    Label1.Text = curTxt
                Else
                    Beep()
                End If
            Else
                Beep()
            End If
    
        End Sub
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  7. #7

  8. #8

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by cicatrix View Post
    Allright, but some validation might be in order. What if I dial 9:99:99?
    The part for the time in the book states: "The user should be able to enter a number of hours no greater than 9, a number of minutes no greater than 59 and a number of seconds no greater than 59; otherwise, the invalid cook time will be set to zero."

  9. #9

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by stanav View Post
    Try this. Set your form's KeyPreview property to True and drop a Label to it (named Label1) then paste this code in. Now run it and try to type some values using the keyboard.
    Code:
     Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
            Dim curTxt As String = Label1.Text.Replace(":", "")
            If curTxt.Length < 6 Then
                Dim ch As Char = e.KeyChar
                If Char.IsNumber(ch) Then
                    curTxt &= ch
                    If curTxt.Length > 2 Then
                        For i As Integer = curTxt.Length - 2 To 1 Step -2
                            curTxt = curTxt.Insert(i, ":")
                        Next
                    End If
                    Label1.Text = curTxt
                Else
                    Beep()
                End If
            Else
                Beep()
            End If
    
        End Sub
    I tried this, but call me a newbie, I dont know how to set my form's KeyPreview property to True...

  10. #10
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by cicatrix View Post
    Allright, but some validation might be in order. What if I dial 9:99:99?
    Actually, that's a valid value for microwaves (at least with the ones I've been using)... They don't automatically change 90 seconds to 1:30.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  11. #11

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by stanav View Post
    Actually, that's a valid value for microwaves (at least with the ones I've been using)... They don't automatically change 90 seconds to 1:30.
    Yeah, but I gotta follow the books direction, not basic logic unfortunately... lol

  12. #12
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by EiNST3iN View Post
    I tried this, but call me a newbie, I dont know how to set my form's KeyPreview property to True...
    In the designer, if you click on the form's title bar to select it, then go to the property window (where you set the properties for the current selected control in the designer), look for the KeyPreview property and change its value to True.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  13. #13

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by stanav View Post
    In the designer, if you click on the form's title bar to select it, then go to the property window (where you set the properties for the current selected control in the designer), look for the KeyPreview property and change its value to True.
    Thanks, I will try that again now...

  14. #14

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by stanav View Post
    Try this. Set your form's KeyPreview property to True and drop a Label to it (named Label1) then paste this code in. Now run it and try to type some values using the keyboard.
    Code:
     Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
            Dim curTxt As String = Label1.Text.Replace(":", "")
            If curTxt.Length < 6 Then
                Dim ch As Char = e.KeyChar
                If Char.IsNumber(ch) Then
                    curTxt &= ch
                    If curTxt.Length > 2 Then
                        For i As Integer = curTxt.Length - 2 To 1 Step -2
                            curTxt = curTxt.Insert(i, ":")
                        Next
                    End If
                    Label1.Text = curTxt
                Else
                    Beep()
                End If
            Else
                Beep()
            End If
    
        End Sub
    Okay, this did display in time format like I want which is AWESOME! How do I get it to accept from the 0-9 keypad built into the GUI I made and not the keyboard?

    As well when I type it wont hide the clock and display the lblText Label where the input is.

  15. #15
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Make Label Format Time 9:59:59

    1. If the digit entered is 7, 8 or 9 - it can be either hours, single minutes or single seconds
    2. If the digit entered is 6 it can be either hours or single minutes
    3. If the digit entered is 1, 2, 3, 4, 5 - it can be anything

    If the first digit is, say 9, then it can be either 9 hours or 9 minutes or 9 seconds
    so what should we display: 0:00:09, 0:09:00 or 9:00:00?

    Logic suggest that we display 0:00:09, but what if the user presses 5 afterwards?
    Should we switch to 9:50:00? And then we should continue from the 0 that comes immediately after 5.

    This turned out to be more difficult than I anticipated

  16. #16

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by cicatrix View Post
    1. If the digit entered is 7, 8 or 9 - it can be either hours, single minutes or single seconds
    2. If the digit entered is 6 it can be either hours or single minutes
    3. If the digit entered is 1, 2, 3, 4, 5 - it can be anything

    If the first digit is, say 9, then it can be either 9 hours or 9 minutes or 9 seconds
    so what should we display: 0:00:09, 0:09:00 or 9:00:00?

    Logic suggest that we display 0:00:09, but what if the user presses 5 afterwards?
    Should we switch to 9:50:00? And then we should continue from the 0 that comes immediately after 5.

    This turned out to be more difficult than I anticipated
    I agree with the difficult part...

    Off the books 'guidelines' I am going to guess that if the user doesnt enter a format that doesnt follow the time rules, then it will need to change the time back to 0 when they hit Start.

    So there is no entering 90 if you really want 1:30... That keeps it kinda simple I think...

  17. #17
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Make Label Format Time 9:59:59

    Resetting wouldn't help, by the way.
    If you want to enter 9:59:42, the first digit would be 9:
    1. 9 -> 0:00:09
    2. 5 -> 0:00:95 -> simple validation would fail at this point and the display be reset to all zeroes.


    Instead it should be something like this:
    2. 5 -> 0:09:50
    3. 9 -> 0:09:59
    4. 4 -> 9:59:40
    5. 2 -> 9:59:42

    And on the real microwave display there must be some blinking of the digit position being active at the moment.

  18. #18
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Make Label Format Time 9:59:59

    So the way I interpret it like this:
    - The user can enter a maximum of 5 digits
    - 1st digit can be 0-9
    - 2nd digit can be 0-5
    - 3rd digit can be 0-9
    - 4th digit can be 0-5
    - 5th digit can be 0-9
    If the user enter in any digit out of its range, the clock resets to 0:00:00.

    There you go. You just have to keep track of which digit is being entered and test it against its range, if it's out of range, reset the clock; otherwise, append the digit to the input string, format it (inserting ":" at proper location) then assign it to the label.text.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  19. #19
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Make Label Format Time 9:59:59


    I know, I'm being boring but... about the third digit:
    I want to set a time of 0:01:47 (so I press 1, 4, 7)

    My microwave does this with a dial you can turn clockwise or counterclockwise thus changing the time on the display.

  20. #20

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Quote Originally Posted by cicatrix View Post
    Resetting wouldn't help, by the way.
    If you want to enter 9:59:42, the first digit would be 9:
    1. 9 -> 0:00:09
    2. 5 -> 0:00:95 -> simple validation would fail at this point and the display be reset to all zeroes.


    Instead it should be something like this:
    2. 5 -> 0:09:50
    3. 9 -> 0:09:59
    4. 4 -> 9:59:40
    5. 2 -> 9:59:42

    And on the real microwave display there must be some blinking of the digit position being active at the moment.
    No, there is a Start button on my GUI, so you can enter :95 and it wont clear that as wrong until you hit the Start button.

    Its only considered a wrong entry in the display if the number is in the wrong time format when you hit the Start button.

    So basically I just need a way to enter numbers in that time format, but if the user falls out of the 9:59:59 limit boundary, then it will display 0 and not do anything when they hit Start.

  21. #21

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Any other help with a code to just get that label to accept time format?

  22. #22
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Make Label Format Time 9:59:59

    So you only validate the entered time when the user presses the Start button? That would make it easier.
    In the start button click event handler, you take the label's text and split it at the ":" this will gives you an array of string. You will convert each array element to an integer and test its value. For example
    Code:
    Dim parts() as string = label1.text.split(":"c)
    Dim hr as Integer = CInt(parts(0))
    Dim min As Integer = CInt(parts(1))
    Dim sec as Integer = CInt(parts(2))
    If hr > 9 OrElse min > 59 OrElse sec > 59 Then
       'Invalid time.... Reset Clock
    EndIf
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  23. #23

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    What?

  24. #24
    Lively Member
    Join Date
    Feb 2010
    Posts
    120

    Re: Make Label Format Time 9:59:59

    I think u can do like this
    add a timer and a label
    add this to the timer

    Code:
    Label1.Text = Timeofday
    and make sure the timer is enabled

    It will have like this 10:12:55 PM

    And if u want that the timer should not go above 9:59:59

    go in the label_textCHanged property

    add this
    Code:
    If Label1.Text = "9:59:59 AM" Then
                Timer1.Stop()
            ElseIf Label1.Text = "9:59:59 PM" Then
                Timer1.Stop()
    End if
    or make a textbox and add in the textbox_TextChanged property


    Code:
    If TextBox1.Text = "9:59:59 AM" Then
                Timer1.Stop()
            ElseIf TextBox1.Text = "9:59:59 PM" Then
                Timer1.Stop()
    End if
    Last edited by watson123; Feb 13th, 2010 at 11:07 PM.

  25. #25

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Yeah, but that does NOT do anything about making the INPUT TIME from the keypad on the GUI in that time format. All that does it makes a real clock time count down from its default setting.

  26. #26

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Here is the GUI of my program if it helps.



    I need to be able to have the user type in their time using the keypad I have put on the GUI.

    I am having trouble getting the inputted number to turn into a time format.

    For example:
    If the user inputs 130
    I need the display to countdown from: 1:30 and display it in that format.

    The max that can be entered is 9:59:59.

    The BIGGEST part I need help with is getting the input number to go into time format. HH:MM:SS

    Here is the code I have if it helps:
    Code:
    Option Strict On
    
    Public Class Form1
    
        Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
            lblYellow.Show()
            lblGray.Hide()
            lblClock.Hide()
            lblTime.Show()
            Timer1.Enabled = True
            Beep()
        End Sub
    
        Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
            lblYellow.Hide()
            lblGray.Show()
            lblClock.Show()
            lblTime.Text = ""
            lblTime.Hide()
            Timer1.Enabled = False
            Beep()
        End Sub
    
        Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStop.Click
            lblYellow.Hide()
            lblGray.Show()
            If lblTime.Text > "0" Then
                lblClock.Hide()
            End If
            If lblTime.Text = "DONE!" Then
                lblTime.Hide()
                lblClock.Show()
                lblTime.Text = ""
            End If
            Timer1.Enabled = False
            Beep()
        End Sub
    
        Private Sub btn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn1.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn1.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn2.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn3.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn3.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn4.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn4.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn5.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn5.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn6.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn6.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn7.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn7.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn8.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn8.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn9.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 0 Then lblTime.Text += btn9.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click
            If lblTime.Text = "DONE!" Then
                lblTime.Text = ""
            End If
            If lblTime.Text.Length >= 1 Then lblTime.Text += btn0.Text
            Beep()
            lblClock.Hide()
            lblTime.Show()
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Dim A As Integer
            Dim B As Integer
    
            If lblTime.Text > "0" Then
                Timer1.Enabled = True
                A = CInt(lblTime.Text)
                B = 1
                lblTime.Text = CStr(A - B)
            End If
            If lblTime.Text = "0" Then
                Beep()
                lblTime.Text = "DONE!"
                Timer1.Enabled = False
                lblYellow.Hide()
                lblGray.Show()
            End If
            If lblTime.Text = "" Then
                Timer1.Enabled = False
                lblYellow.Hide()
                lblGray.Show()
            End If
        End Sub
    
        Private Sub btnClock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClock.Click
            If lblTime.Text = "" Or Timer1.Enabled = False Then
                lblClock.Show()
                lblTime.Hide()
                lblYellow.Hide()
                lblGray.Show()
                Timer2.Enabled = True
                Timer1.Enabled = False
            End If
            Beep()
        End Sub
    
        Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
            lblClock.Text = CStr(TimeOfDay)
        End Sub
    End Class

  27. #27

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    Help! Please! Its due this week... And this is the last thing I need to do.

  28. #28

    Thread Starter
    Junior Member EiNST3iN's Avatar
    Join Date
    Oct 2009
    Posts
    26

    Re: Make Label Format Time 9:59:59

    F&*^ my life!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width