• Program Runtime ( my first application in VB 2008 ) ( Source included )
    7 replies, posted
Screenshot: [img]http://img514.imageshack.us/img514/1535/image1yw.png[/img] Description: [indent]A very simple program, which on startup shows the date/time the program was started. Along with how many Hours, Minutes, and Seconds, the program has been running ( in 2 different styles ). Not much of a accomplishment, but it helped me to become familiar with how simple VB is.[/indent] Source code: [code]Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load starttime_disp.Text = Format(Now) Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim number, number2, second As Single second = Second_disp.Text number2 = Second_disp.Text + 1 If second = "60" Then Minute_disp.Text = Minute_disp.Text + 1 Second_disp.Text = 0 End If If Minute_disp.Text = "60" Then Hour_disp.Text = Hour_disp.Text + 1 Minute_disp.Text = "0" End If Second_disp.Text = number2 style2_disp.Text = "Hours: " & Hour_disp.Text & " Minutes: " & Minute_disp.Text & " Seconds: " & Second_disp.Text End Sub End Class[/code] Download the source code + compiled program ( in bin\release directory ): [indent][url]http://www.mediafire.com/?sharekey=d5f8fc661e3ccdd4d8f14848abf485dde04e75f6e8ebb871[/url][/indent]
Good job, I hope you progress well with programming :) My only suggestions are: 1) Timer isn't very accurate 2) You could better structure this with the DateTime structure, maybe using DateTime.Now to measure elapsed time between the stored time of the program start and the current time; using a timer to update the GUI (As that is non time critical) - [url]http://articles.techrepublic.com.com/5100-10878_11-6089546.html[/url]
Nice for your first program.
[QUOTE=Tezza1234;17198069]Good job, I hope you progress well with programming :) My only suggestions are: 1) Timer isn't very accurate 2) You could better structure this with the DateTime structure, maybe using DateTime.Now to measure elapsed time between the stored time of the program start and the current time; using a timer to update the GUI (As that is non time critical) - [url]http://articles.techrepublic.com.com/5100-10878_11-6089546.html[/url][/QUOTE] Thanks, I'll look at that, and hopefully release a new ( more optimized ) revision of this application.
Next step: Have it accept arguments so that when you drag a program onto it's icon it starts, runs the program you dragged, and times how long that program was open.
[QUOTE=jivemasta;17198331]Next step: Have it accept arguments so that when you drag a program onto it's icon it starts, runs the program you dragged, and times how long that program was open.[/QUOTE] I never thought of that, but it's a good target to work towards. ( out of stupidity ) what would be best for said program, A windows form appliation, or Console app?
I'd say form, but with a minimize to tray type of thing.
Nice for your first program, accept all criticism you get and improve and you'll progress well :)
Sorry, you need to Log In to post a reply to this thread.