Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.Net Coding Challenge #3
#11
Looks really nice KoBE. You should set it so that the stop button resets the clock back to 0:00:00 though. When you stop it, it's basically like pressing pause, but when you press start after pressing stop, then it goes back to 0 and starts immediately.
Reply
#12
(04-19-2011, 11:01 AM)Infinity Wrote: Looks really nice KoBE. You should set it so that the stop button resets the clock back to 0:00:00 though. When you stop it, it's basically like pressing pause, but when you press start after pressing stop, then it goes back to 0 and starts immediately.

Yea.. I thought about that. I though about just renaming the button to reset. And resetting it. And not have a stop button at all.
Reply
#13
(04-19-2011, 01:07 PM)KoBE Wrote: Yea.. I thought about that. I though about just renaming the button to reset. And resetting it. And not have a stop button at all.

For a real timestopper they have a start button, a stop button, and a reset button. Pause should have been the stop button I think, and then you can make things even more fancy by adding a laps recorder, where if you press the laps button it will record the time that you pressed the lap button in a listbox (or append the laps in a multiline textbox on individual lines), until you press stop and reset which will delete all the data from the laps listbox.
Reply
#14
Here's my submission anyway:

[Image: unledoy.png]

Code:
Public Class Form1

    'Started defining the values for the numbers as strings right off the bat so I can reference them anywhere in the code inside of the Public class for form 1..
    Dim a As String
    Dim b As String
    Dim c As String
    Dim x As String
    Dim y As String
    Dim z As String
    Dim h As String
    Dim m As String
    Dim s As String
    Dim u As String
    Dim v As String

    'On form load (when app starts) display the 0's
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        a = "0"
        b = "0"
        c = "0"
        x = "0"
        y = "0"
        z = "0"
        u = 0
        h = a + b
        m = c + x
        s = y + z
        'To set the display as "00:00:00.00"
        Label1.Text = h + ":" + m + ":" + s + "." + u
    End Sub

    'Subroutine for the timer count function using if then statements
    Sub CountTime()

        If Val(u) < 9 Then
            u = u + 1

            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(z) < 9 Then
            u = 0

            z = z + 1

            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(y) < 5 Then
            u = 0
            z = 0
            y = y + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u + v
        ElseIf Val(x) < 9 Then
            u = 0
            z = 0
            y = 0
            x = x + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(c) < 5 Then
            u = 0
            z = 0
            y = 0
            x = 0
            c = c + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(b) < 9 Then
            u = 0
            z = 0
            y = 0
            x = 0
            c = 0
            b = b + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(b) < 9 Then
            u = 0
            z = 0
            y = 0
            x = 0
            c = 0
            b = b + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u
        ElseIf Val(a) < 9 Then
            u = 0
            z = 0
            y = 0
            x = 0
            c = 0
            b = 0
            a = a + 1
            Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u

        End If

    End Sub

    'Use the CountTime subroutine for Timer1
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        CountTime()
    End Sub

    Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click
        'Start
        Timer1.Enabled = True
    End Sub

    Private Sub Stop_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_Button.Click
        'Stop
        Timer1.Enabled = False
    End Sub

    Private Sub Reset_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset_Button.Click
        'Reset - (Set everything back to 0's)
        Timer1.Enabled = False
        a = "0"
        b = "0"
        c = "0"
        x = "0"
        y = "0"
        z = "0"
        u = "0"

        h = a + b
        m = c + x
        s = y + z
        'To set the display as "00:00:00.00"
        Label1.Text = h + ":" + m + ":" + s + "." + u
    End Sub

    'Close The application
    Private Sub Close_App_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close_App.Click
        End
    End Sub

    'Extra crap
    'Make windows OnTop option active or inactive
    Private Sub CheckBox1_CheckedChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        'if it's ticked, then keep above all other windows
        If CheckBox1.Checked Then
            Me.TopMost = True
            'If it's not ticked then don't keep it above all other windows
        ElseIf CheckBox1.Checked = False Then
            Me.TopMost = False
        End If
    End Sub
End Class

Direct Download:
http://download789.mediafire.com/9mmf76q.../Timer.exe
Reply
#15
In your Sub CountTime() you could just place...
Code:
Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u

...at the bottom after your End If. That way you wouldn't need it in EACH ElseIf.

It looks pretty good.
Reply
#16
(04-20-2011, 06:34 AM)KoBE Wrote: In your Sub CountTime() you could just place...
Code:
Label1.Text = a + b + ":" + c + x + ":" + y + z + "." + u

...at the bottom after your End If. That way you wouldn't need it in EACH ElseIf.

It looks pretty good.

Ahh, thats true. I did this one pretty quick lol, I don't have the app anymore on my computer, but I still have the project.
Reply
#17
Well that was easy.
Here it is... (sorry for not working on the GUI)

[Image: ilaefy.gif]

Code:
Public Class Form1
    Dim SW As New System.Diagnostics.Stopwatch
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Enabled = True
        SW.Start()
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = String.Format("{0}:{1}:{2}:{3}", SW.Elapsed.Hours.ToString, SW.Elapsed.Minutes.ToString, SW.Elapsed.Seconds.ToString, SW.Elapsed.Milliseconds.ToString)
    End Sub
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Timer1.Stop()
        SW.Reset()
        Label1.Text = "0:0:0:000"
    End Sub
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Timer1.Enabled = False
        SW.Stop()
    End Sub
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Timer1.Enabled = True
        SW.Start()
    End Sub
End Class
[Image: just-cause-2-header.jpg]
Reply
#18
Looks decent, but you should have made the default as 00:00:00:000 if you're going to use all 3 digits at the end for the smallest increments in time. Does it go up to 10 seconds too? Just because you only have 1 digit for the seconds, I was wondering if it would add a 1 to the beginning and so on?
Reply
#19
(05-04-2011, 10:55 AM)Infinity Wrote: Looks decent, but you should have made the default as 00:00:00:000 if you're going to use all 3 digits at the end for the smallest increments in time. Does it go up to 10 seconds too? Just because you only have 1 digit for the seconds, I was wondering if it would add a 1 to the beginning and so on?

Yes it does go up to 10 seconds. It increases the number of digits when it needs. Yeye

[Image: inmYxy.png]
[Image: just-cause-2-header.jpg]
Reply
#20
Looks good iCrack... (where are the comments bro?)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Code Challenge - Created by Ace AceInfinity 5 1,713 04-24-2012, 10:27 AM
Last Post: AceInfinity
  Help with coding jerrojack 1 882 12-29-2011, 03:27 AM
Last Post: AceInfinity
  Coding-Central.net - Coding, cracking and webmastering. w00pz 5 2,436 09-02-2011, 01:43 PM
Last Post: AceInfinity
  Help Coding A Downloader? Fragma 9 3,432 08-25-2011, 06:10 PM
Last Post: LiveModz
  .Net Coding Challenge #5 iCrack 18 5,937 05-21-2011, 12:49 AM
Last Post: thanasis2028

Forum Jump:


Users browsing this thread: 8 Guest(s)