[RESOLVED] What's the best way to have the user enter a time?
I've never really worked with values of time in VB before. I now have a program where the user needs to enter a value in hours and minutes.
It's too keep track of how late someone shows up for work so I think I'd like the user to enter something like 1:22 for one hour and twenty two minutes.
What controls, formats are best suited for using time ?
Re: What's the best way to have the user enter a time?
I've only had one app before that needed time by itself (no date attached) input, but what i used was the date/time picker set for time only. It seemed to work pretty well.
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
Re: What's the best way to have the user enter a time?
Use a Masked Edit control
Pradeep
Pradeep, Microsoft MVP (Visual Basic) Please appreciate posts that have helped you by clicking icon on the left of the post.
"A problem well stated is a problem half solved." — Charles F. Kettering
Re: What's the best way to have the user enter a time?
Originally Posted by The_Grudge
I've never really worked with values of time in VB before. I now have a program where the user needs to enter a value in hours and minutes.
It's too keep track of how late someone shows up for work so I think I'd like the user to enter something like 1:22 for one hour and twenty two minutes.
What controls, formats are best suited for using time ?
If the user have to type in the time then go to A if the administartor does it then go to B
A:
Since the user have to type in the time he got to work i recomand you to NOT DO IT, you should have a clock in lbltime and when the user 'clook in' then your app should take a time stemp of that time and he is why:
I build build a 'clook in' 'clook out' software to mange worker time for a shop, after a while the shop maneger realise that when a chasher came late (in 1:00 for instance) they typed (11:30) and liyed. right after i got that massage from the maneger, i want and made that the user will NOT asked what time but the app will take a time stemp.
B: since an administrator will type in the time (or someone you can trust) you could simply use an inputbox
1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
2) If someone has been useful to you please show your respect by rating their posts.
3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
4) Before posting your question, make sure you checked this links: MICROSOFT MSDN -- VB FORUMS SEARCH
5)Support Classic VB - A PETITION TO MICROSOFT
Re: [RESOLVED] What's the best way to have the user enter a time?
You can use this code too:
VB Code:
Private Sub Form_Load()
gettime
End Sub
Public Function gettime()
gettime = InputBox("Please indicate the exact time of user login:", "Exact Time", Time)
If gettime = "" Then
MsgBox "You Must Type The Time", vbExclamation, "!!!!!!!!"
gettime
Else
MsgBox "User Loged in on " & gettime, vbInformation, "Loged Time"
End If
End Function
1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
2) If someone has been useful to you please show your respect by rating their posts.
3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
4) Before posting your question, make sure you checked this links: MICROSOFT MSDN -- VB FORUMS SEARCH
5)Support Classic VB - A PETITION TO MICROSOFT