Visual Basic Employee Clock

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 86
Reputation: jhonnyboy is an unknown quantity at this point 
Solved Threads: 0
jhonnyboy jhonnyboy is offline Offline
Junior Poster in Training

Visual Basic Employee Clock

 
0
  #1
Feb 2nd, 2009
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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 6
Reputation: crow_w is an unknown quantity at this point 
Solved Threads: 0
crow_w crow_w is offline Offline
Newbie Poster

Re: Visual Basic Employee Clock

 
1
  #2
Feb 2nd, 2009
I think this addresses your needs:

  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
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 86
Reputation: jhonnyboy is an unknown quantity at this point 
Solved Threads: 0
jhonnyboy jhonnyboy is offline Offline
Junior Poster in Training

Re: Visual Basic Employee Clock

 
0
  #3
Feb 2nd, 2009
i made a simple one like this one:

  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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 6
Reputation: crow_w is an unknown quantity at this point 
Solved Threads: 0
crow_w crow_w is offline Offline
Newbie Poster

Re: Visual Basic Employee Clock

 
0
  #4
Feb 2nd, 2009
Originally Posted by jhonnyboy View Post
i made a simple one like this one:

  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:

  1. Dim UserName As String = Environ("USERNAME")
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 63
Reputation: 4advanced is an unknown quantity at this point 
Solved Threads: 10
4advanced 4advanced is offline Offline
Junior Poster in Training

Re: Visual Basic Employee Clock

 
0
  #5
Feb 3rd, 2009
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC