Results 1 to 24 of 24

Thread: Stopwatch Application works? or not?

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Stopwatch Application works? or not?

    Hi,
    I just decided to join up at this forum, basically because I loved some posts by some people and wanted to provide feedback.

    Other than that,
    I am still an amateur at VB (so go easy on me )
    I just created my first Application on my own that I uploaded to Sourceforge (at which I registered for uploading my Apps)

    Unfortunately I haven't got any feedback.

    It'd be great if someone could try it out.
    I asked my friends to try it, according to them it doesn't work.
    When I tried it on Windows XP Service Pack 3, it does.

    The link:

    HTML Code:
    https://sourceforge.net/p/xtrmstpwtch
    If needed I could upload the Project Folder as well.


    Thanks guys..
    Hoping for a response.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Stopwatch Application works? or not?

    Perhaps you could provide some more details besides "it doesn't work". If we know what we're looking for then we will have a better chance of finding it. We might even be able to solve the issue without running or even looking at the code if it's something obvious.

  3. #3
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: Stopwatch App working or not?

    It doesn't work here too, Windows 7 SP1 32x, when i run, i got this error

    Extreme Stopwatch

    Extreme Stopwatch has stopped working

    Windows can check online for a solution to the problem.

    [Check online for a solution and close the program]
    [Close the program]
    [Debug the program]



  4. #4

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    I just asked one of them to send me the pictures of the errors:

    Name:  1.jpg
Views: 299
Size:  129.2 KB

    Name:  2.jpg
Views: 276
Size:  113.0 KB

    Name:  3.jpg
Views: 291
Size:  121.2 KB


    I'm not an expert but I think its got something to do with the .chm help file

    As much as I remember they were running Windows 7 32bit as well and have Dot Net Framework installed as well.
    I tried it on Windows XP SP3 and it worked fine.

    If it helps: I'm running Windows 7 x64 (Created on the same machine)

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    Re: Stopwatch App working or not?

    I'd have to say that I'm a bit reluctant to download some random app. Is the source there, or just the .exe?
    My usual boring signature: Nothing

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Stopwatch Application works? or not?

    You don't have to be an expert to read the error message in the first screen shot. Can you just post the few lines of code you use to access that .chm file? The thing is that it tries to reach it in the user default folder and only administrators have access to that. So it won't work on Windows that have AUP protection unless they run the app as admin. You have installed and tries to access the help file from the wrong directory.
    Last edited by Joacim Andersson; Oct 1st, 2012 at 05:06 PM.

  7. #7
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Stopwatch Application works? or not?

    Not the .chm file! UAC disabled and it still won't start.

    Project files would certainly help at this stage.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Stopwatch Application works? or not?

    The first error message clearly reads: Access to path denied! So the user is denied to access the path showing in the message. If you don't post any of your code related to this error message then I can't really help you since at the moment I can't (and frankly am not very interested) in downloading your whole application to do the error checking for you.

  9. #9

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Really sorry for the late reply.

    This is the code related to the .chm Help file.

    Code:
        Private Sub lblHelp_Click(sender As System.Object, e As System.EventArgs) Handles lblHelp.Click
            System.Windows.Forms.Help.ShowHelp(Me, "Help.chm", HelpNavigator.AssociateIndex)
        End Sub
    Is it possible that a previous installation of the application caused this? maybe it wasn't uninstalled properly?

    Becuase My first release of the Application's code for the Help file was:

    Code:
        Private Sub Stopwatch_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            If Not IO.File.Exists("/Help.chm") Then
                IO.File.Copy("/Help.chm", "C:\Users\Default\AppData\Local\Temp\")
            End If
            End Timer Button is Diabled upon Load
            btnEnd.Enabled = False
        End Sub
    
        Private Sub lblHelp_Click(sender As System.Object, e As System.EventArgs) Handles lblHelp.Click
            System.Windows.Forms.Help.ShowHelp(Me, "C:\Users\Default\AppData\Local\Temp\Help.chm", HelpNavigator.AssociateIndex)
        End Sub
    Thus, the second release doesn't copy the File to C:\Users\Default\AppData\Local\Temp\, instead it open the Help File directly from the Installation Directory (where the App is installed)

  10. #10
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Stopwatch Application works? or not?

    Both your older code and the new one could cause the same error. Your older code is completely wrong since it first state that if the chm file is not found in the root folder of the active drive then copy it from the root folder of the active drive, which of course is impossible.

    Your new code does not try to open the help file from the application path but rather from the current path (current working folder), which normally would be the application path but doesn't have to be. Do you anywhere in your code change the active path?

  11. #11

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    If I understand your question correctly...
    No. I don't change the active path.

    The project folder is quite big 51MB almost in size.

    I hope its OK if I provide all of the codes.
    PS: I apologize for the Certain unnecessary comments

    Code:
    Imports System.Net.Mail
    
    Public Class Stopwatch
    
        Sub ResetTimer()
            'Sub Procedure for Resetting the Timer
            btnEnd.Enabled = False
            ToolStripStatusLabel.Text = "Ready"
            btnStart.Enabled = True
            btnReset.Enabled = False
            TimerStopwatch.Enabled = False
    
            lblElapsedHrs.Text = ("0")
            lblElapsedMints.Text = ("00")
            lblElapsedSecs.Text = ("00")
            lblElapsedMilli.Text = ("00")
    
            lblStartHours.Text = ("00")
            lblStartMinutes.Text = ("00")
            lblStartSeconds.Text = ("00")
            lblEndHours.Text = ("00")
            lblEndMinutes.Text = ("00")
            lblEndSeconds.Text = ("00")
            lblnum1value.Text = ("0.0")
            lblnum2value.Text = ("0.0")
            lblnum3value.Text = ("0.0")
            lblnum4value.Text = ("0.0")
            lblnum5value.Text = ("0.0")
        End Sub
    
        'Public Sub SoundStop()
        '    Sub Procedure for Disabling Sound
        '    My.Computer.Audio.Stop()
        'End Sub
    
    
        Private Sub Stopwatch_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            'If Not IO.File.Exists("/Help.chm") Then
            '    IO.File.Copy("/Help.chm", "C:\Users\Default\AppData\Local\Temp\")
            'End If
            'End Timer Button is Diabled upon Load
            btnEnd.Enabled = False
        End Sub
    
        Private Sub TimerStopwatch_Tick(sender As System.Object, e As System.EventArgs) Handles TimerStopwatch.Tick
            'Elapsed Time is incremented by 1
    
            lblElapsedMilli.Text = Val(lblElapsedMilli.Text) + 1
            If lblElapsedMilli.Text = "64" Then
                lblElapsedSecs.Text = Val(lblElapsedSecs.Text) + 1
    
                My.Computer.Audio.Play(My.Resources.Tick, AudioPlayMode.Background)
    
                lblElapsedMilli.Text = "0"
            End If
    
            If lblElapsedSecs.Text = "60" Then
                lblElapsedMints.Text = Val(lblElapsedMints.Text) + 1
                lblElapsedSecs.Text = "0"
            End If
    
            If lblElapsedMints.Text = "60" Then
                lblElapsedHrs.Text = Val(lblElapsedHrs.Text) + 1
                lblElapsedMints.Text = "0"
            End If
    
            If lblElapsedHrs.Text = "24" Then
                lblElapsedHrs.Text = "0"
            End If
    
        End Sub
    
        Private Sub btnStart_Click(sender As System.Object, e As System.EventArgs) Handles btnStart.Click
    
            'Enabling Timer
    
            TimerStopwatch.Enabled = True
            My.Computer.Audio.Play(My.Resources.Startbtn_ClickSnd, AudioPlayMode.Background)
    
            'Establish and print starting time
    
            lblStartHours.Text = TimeOfDay.Hour
            lblStartMinutes.Text = TimeOfDay.Minute
            lblStartSeconds.Text = TimeOfDay.Second
            ToolStripStatusLabel.Text = "Timer Running"
            btnEnd.Enabled = True
            btnStart.Enabled = False
            btnReset.Enabled = False
    
        End Sub
    
        Private Sub btnEnd_Click(sender As System.Object, e As System.EventArgs) Handles btnEnd.Click
    
            TimerStopwatch.Enabled = False
            My.Computer.Audio.Play(My.Resources.Endbtn_ClickSnd, AudioPlayMode.Background)
    
            'Storing the Time at which the "END TIMER Button" was clicked
            lblnum5value.Text = lblnum4value.Text
            lblnum4value.Text = lblnum3value.Text
            lblnum3value.Text = lblnum2value.Text
            lblnum2value.Text = lblnum1value.Text
            lblnum1value.Text = Val(lblElapsedHrs.Text) & lblColon1.Text & Val(lblElapsedMints.Text) & lblColon2.Text & Val(lblElapsedSecs.Text) & lblColon3.Text & Val(lblElapsedMilli.Text)
    
            'Establish and print Ending time
            lblEndHours.Text = TimeOfDay.Hour
            lblEndMinutes.Text = TimeOfDay.Minute
            lblEndSeconds.Text = TimeOfDay.Second
    
            ToolStripStatusLabel.Text = "Ready"
            btnStart.Enabled = True
            btnReset.Enabled = True
            btnEnd.Enabled = False
        End Sub
    
        Private Sub btnReset_Click(sender As System.Object, e As System.EventArgs) Handles btnReset.Click
            'Calling Sub Procedure for Resetting all timer values
            My.Computer.Audio.Play(My.Resources.WindingSnd, AudioPlayMode.Background)
            ResetTimer()
        End Sub
    
        Private Sub lblSettings_Click(sender As System.Object, e As System.EventArgs) Handles lblSettings.Click
    
            Settings.ShowDialog()
        End Sub
    
        Private Sub lblSettings_MouseHover(sender As Object, e As System.EventArgs) Handles lblSettings.MouseHover
            lblSettings.ForeColor = Color.SteelBlue
        End Sub
    
        Private Sub lblSettings_MouseLeave(sender As Object, e As System.EventArgs) Handles lblSettings.MouseLeave
            lblSettings.ForeColor = Color.Black
        End Sub
    
        Private Sub lblHelp_Click(sender As System.Object, e As System.EventArgs) Handles lblHelp.Click
            System.Windows.Forms.Help.ShowHelp(Me, "Help.chm", HelpNavigator.AssociateIndex)
            'System.Windows.Forms.Help.ShowHelp(Me, "C:\Users\Default\AppData\Local\Temp\Help.chm", HelpNavigator.AssociateIndex)
        End Sub
    
        Private Sub lblHelp_MouseHover(sender As Object, e As System.EventArgs) Handles lblHelp.MouseHover
            lblHelp.ForeColor = Color.SteelBlue
        End Sub
    
        Private Sub lblHelp_MouseLeave(sender As Object, e As System.EventArgs) Handles lblHelp.MouseLeave
            lblHelp.ForeColor = Color.Black
        End Sub
    
        Private Sub lblAbout_Click(sender As Object, e As System.EventArgs) Handles lblAbout.Click
            About.ShowDialog()
        End Sub
    
        Private Sub lblAbout_MouseHover(sender As Object, e As System.EventArgs) Handles lblAbout.MouseHover
            lblAbout.ForeColor = Color.SteelBlue
        End Sub
    
        Private Sub lblAbout_MouseLeave(sender As Object, e As System.EventArgs) Handles lblAbout.MouseLeave
            lblAbout.ForeColor = Color.Black
        End Sub
    
        Private Sub lblFeedback_Click(sender As Object, e As System.EventArgs) Handles lblFeedback.Click
            MessageBox.Show("Contact us at: pcteknixtz@gmail.com", "Feedback", MessageBoxButtons.OK, MessageBoxIcon.Information)
            MessageBox.Show("Visit us at:  http://pcteknix.blogspot.com", "Feedback", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End Sub
    
        Private Sub lblFeedback_MouseHover(sender As Object, e As System.EventArgs) Handles lblFeedback.MouseHover
            lblFeedback.ForeColor = Color.SteelBlue
        End Sub
    
        Private Sub lblFeedback_MouseLeave(sender As Object, e As System.EventArgs) Handles lblFeedback.MouseLeave
            lblFeedback.ForeColor = Color.Black
        End Sub
    
        Private Sub LinkLabelWebsite_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabelWebsite.LinkClicked
            System.Diagnostics.Process.Start("http://pcteknix.blogspot.com")
        End Sub
    End Class

  12. #12

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    I think I got it working guys,
    Thanks for the Help.
    I just need someone to test it out now..
    Can't wait till someone downloads it.

  13. #13

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Tested it and Working...
    both Windows 7 32/64 bit and Windows xp as well..

    Thanks for the Help Everyone.

  14. #14
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Stopwatch Application works? or not?

    Hey. It doesn't crash anymore! Think you should do something about the format of single digit times though!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  15. #15
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Stopwatch Application works? or not?

    while we're on the subject, have a look at my countDownTimer (need 5 downloads)

    http://code.msdn.microsoft.com/count...ntrol-2da92ac3

    it's just code, no executable...

  16. #16

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Quote Originally Posted by dunfiddlin View Post
    Think you should do something about the format of single digit times though!
    I didn't quite get that.. ?



    Quote Originally Posted by .paul. View Post
    while we're on the subject, have a look at my countDownTimer (need 5 downloads)

    http://code.msdn.microsoft.com/count...ntrol-2da92ac3

    it's just code, no executable...
    Sure.. I'll have a look..

  17. #17
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: Stopwatch Application works? or not?

    Name:  a.png
Views: 203
Size:  71.2 KB

    Should always retain the 00:00:00:00 format. 0:00:6:4 not good. Not good at all!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  18. #18
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Stopwatch Application works? or not?

    Are you using a Timer as a stopwatch? Are you aware that there is a stopwatch class?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  19. #19

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Quote Originally Posted by dunfiddlin View Post
    Name:  a.png
Views: 203
Size:  71.2 KB

    Should always retain the 00:00:00:00 format. 0:00:6:4 not good. Not good at all!
    I'll try working on that..
    Thanks for the Feedback..


    *EDIT*
    I couldn't figure out how to achieve i

    Quote Originally Posted by dbasnett View Post
    Are you using a Timer as a stopwatch? Are you aware that there is a stopwatch class?
    Yes, I'm using a Timer..
    I wasn't aware that there's a stopwatch class..

    I'll do some research..

    Thanks for the Feedback ...


    *EDIT*

    Stopwatch Class seems complicated for a beginner like me..
    I'll keep studying though..
    Last edited by TheThinker; Nov 24th, 2012 at 05:56 AM.

  20. #20
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Stopwatch Application works? or not?

    This short example requires a new project with a Timer, a Button, and 3 Labels.

    Code:
        Private Sub Form1_Shown(ByVal sender As Object, _
                                ByVal e As System.EventArgs) Handles Me.Shown
            Label1.Text = "Using timer"
            Label2.Text = "Using stopwatch"
            Label3.Text = "difference"
            Timer1.Interval = 100 'set interval
            Button1.Text = "Start"
        End Sub
    
        Dim stpw As New Stopwatch
        Private Sub Button1_Click(ByVal sender As System.Object, _
                                  ByVal e As System.EventArgs) Handles Button1.Click
            'click Button1 and let it run for a minute or so
            'then click it again
            'Surprised by what you see in the labels?
            'a Timer isn't a Stopwatch!
            If Button1.Text = "Start" Then
                mytSecs = 0
                Timer1.Start() 'start the timer and stopwatch
                stpw.Restart()
                Button1.Text = "Stop"
            Else
                Button1.Text = "Start"
                Timer1.Stop()
            End If
        End Sub
    
        Dim mytSecs As Integer = 0
        Private Sub Timer1_Tick(ByVal sender As System.Object, _
                                ByVal e As System.EventArgs) Handles Timer1.Tick
            mytSecs += 1
            Dim ts As TimeSpan = New TimeSpan(0, 0, 0, 0, mytSecs * Timer1.Interval)
            Dim d As TimeSpan = stpw.Elapsed - ts
            Label1.Text = ts.ToString("mm\:ss\.f")
            Label2.Text = stpw.Elapsed.ToString("mm\:ss\.f")
            Label3.Text = d.ToString("mm\:ss\.f")
        End Sub
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  21. #21
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Stopwatch Application works? or not?

    Quote Originally Posted by TheThinker View Post
    Stopwatch Class seems complicated for a beginner like me..
    I'll keep studying though..
    Really? It has a Start method, a Stop method and an Elapsed property. That Elapsed property is a TimeSpan, which has a ToString method that will output the elapsed time as a String.

  22. #22
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: Stopwatch Application works? or not?

    Quote Originally Posted by TheThinker View Post
    Stopwatch Class seems complicated for a beginner like me..
    I'll keep studying though..
    I agree with jmc, it really is a lot easier, and a lot more accurate, than what you are doing.

    One more sample:

    Code:
    Public Class Form1
    
        Dim stpw As New Stopwatch
        Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
            'if the stopwatch is not running, start it
            If Not stpw.IsRunning Then
                stpw.Restart()
                'or
                'stpw.Reset()
                'stpw.Start()
            End If
            Button2.Select()
        End Sub
    
        Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
            stpw.Stop() 'stop
            Label1.Text = formatTS(stpw.Elapsed)
            Button1.Select()
        End Sub
    
        Private Function formatTS(ts As TimeSpan) As String
            Dim s As String = ""
            'depending on your version of .net
            'choose one of these
            s = ts.ToString("hh\:mm\:ss\.fff") 'show the lap time hh:mm:ss.fff
            ' s = String.Format("{0:00}:{1:00}:{2:00}.{3:000}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds) 'show the lap time hh:mm:ss.fff
            Return s
        End Function
    End Class
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  23. #23

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Thank you both for the Samples/Examples..

    Now I understand more than I did before... and it truly is much simpler and Accurate..

    I'll work on this and switch from Timers to Stopwatch class..

    Thanks..

    (Very Helpful)
    Last edited by TheThinker; Nov 25th, 2012 at 07:28 AM.

  24. #24

    Thread Starter
    Member
    Join Date
    Oct 2012
    Posts
    61

    Re: Stopwatch Application works? or not?

    Successfully switched from Timers to using Stopwatch Class, and it is definetly much more accurate and simpler.

    I'd appreciate a little help on this thread too..
    http://www.vbforums.com/showthread.p...81#post4288081

    I'll be sure to include A Special Thanks to all of you guys in the Next release of the App

    Thanks..

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