943,865 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2438
  • VB.NET RSS
Feb 2nd, 2009
0

Visual Basic Employee Clock

Expand Post »
hey guys im fairly new to visual basic, but very eager to learn it. I am attempting to make an employee clock in.

I want to make a simple clock in that will ask the user to enter their name, and just click a button that will then post that time.

I would then like to get the time and name of the user and dump it into a .txt file

Is there anyway that when the user clicks a button i can grab the current system time and throw it into a label?

How can the program save the information. The user will be clicking on the .exe of the program. When they clock in and the time is visible on the form they will exit the program. Will the program automatically save the clock in time inside the label or when the program restarts it will need to read the time from the .txt file?
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Feb 2nd, 2009
1

Re: Visual Basic Employee Clock

I think this addresses your needs:

VB.NET Syntax (Toggle Plain Text)
  1. Private Sub btnClockIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClockIn.Click
  2. Dim Time As String = Now()
  3. Dim Name As String = txtName.Text
  4.  
  5. 'writes time to label on form
  6. lblTime.Text = Time
  7.  
  8. 'write to file
  9. Dim oFile As System.IO.File
  10. Dim oWrite As System.IO.StreamWriter
  11. oWrite = oFile.CreateText("C:/test.txt")
  12.  
  13. oWrite.WriteLine(Name & "," & Time)
  14.  
  15. oWrite.Close()
  16.  
  17. End Sub
Reputation Points: 20
Solved Threads: 0
Newbie Poster
crow_w is offline Offline
6 posts
since Feb 2009
Feb 2nd, 2009
0

Re: Visual Basic Employee Clock

i made a simple one like this one:

VB.NET Syntax (Toggle Plain Text)
  1.  
  2.  
  3. Using outFile As StreamWriter = New StreamWriter("blahblah.txt")
  4.  
  5. outFile.Write("Clock In: " + TimeOfDay)
  6.  
  7.  
  8. End Using

I was wondering if it was possible to include the name of the current user logged into the computer to the text file. Could this be done?
Reputation Points: 11
Solved Threads: 0
Junior Poster in Training
jhonnyboy is offline Offline
97 posts
since Jul 2008
Feb 2nd, 2009
0

Re: Visual Basic Employee Clock

Click to Expand / Collapse  Quote originally posted by jhonnyboy ...
i made a simple one like this one:

VB.NET Syntax (Toggle Plain Text)
  1.  
  2.  
  3. Using outFile As StreamWriter = New StreamWriter("blahblah.txt")
  4.  
  5. outFile.Write("Clock In: " + TimeOfDay)
  6.  
  7.  
  8. End Using

I was wondering if it was possible to include the name of the current user logged into the computer to the text file. Could this be done?
You might try this:

VB.NET Syntax (Toggle Plain Text)
  1. Dim UserName As String = Environ("USERNAME")
Reputation Points: 20
Solved Threads: 0
Newbie Poster
crow_w is offline Offline
6 posts
since Feb 2009
Feb 3rd, 2009
0

Re: Visual Basic Employee Clock

My.User.Name

Environment.UserName.ToString()

You can checkout the My or Environment objects to find more interesting things.

The My.Computer.Clock object provides properties to find the current local time for the computer and the UTC time. It also exposes the millisecond count from the computer's system timer.
Reputation Points: 33
Solved Threads: 10
Junior Poster in Training
4advanced is offline Offline
67 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: How to change screen resolution programmatically in vb.net 2.0?
Next Thread in VB.NET Forum Timeline: Viewing Data in Datagrid





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC