English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm using Visual Basic 2005 Express, and I'm running into a little bit of trouble. I have this so far...

http://img169.imageshack.us/img169/4538/image1ew4.jpg

...and the only thing I want is the program to output the total for the whole week. Simple, so that the user can input hours the employee started, and finished work.

However, I'm having trouble with the whole AM and PM thing. Once I go to 1PM (changing from counting up, to down), my numbers get all messed up since it wouldn't just be counting like in military time, but go along with the 12 hour clock.

I also understand that after a time is entered for "In-Time" and "Out-Time" for a day, a new value must be created with those hours added up, even though it won't be displayed. And from there, I would take those newly created values, and add them up for the "Total Hrs.".

I was thinking about entering defining things such as this...

11AM = "11"
12PM = "12"
1PM = "13"

Not sure though...please help me =(

Thank you if you can!

2007-03-18 13:55:00 · 2 answers · asked by alphaaxl 1 in Computers & Internet Programming & Design

If anyone even has, or could find the program already written and/or the code for the program, that would be amazing...thank you so much.

2007-03-18 13:58:59 · update #1

2 answers

Scrap the text boxes and use drop downs... then there is no room for user error.
1am = 1
12am = 24

then you can use the values from each against an IF statement (if listbox.text.value = "12AM" then hourout=24 endif)
take the hourout minus hourin and that equals total hours

sorry... VB6, syntax is probably different for VB 2005 express but the idea is the same

2007-03-18 14:59:32 · answer #1 · answered by spl 4 · 0 0

Well AM PM radio buttons for each entry would be a way.

You can ALSO write them in and PARSE, but that presents a problem with 10:30AM because the colon would stop for the VAL() function to obtain a number.

You ARE away of that right, Text Boxes view numbers as characters unless you use the VAL function.

I think your concept of military time is good and maybe you should add a calculator for it or list it on the form

1PM=1300 2PM =1400.

I think listing it is the best way

Then you can VAL the times

920 in
1650 out

Then you subtract using the 60 rule

Boy you're got yourself in a corner

Best way is two fields for each entry

HOURS
9

Minutes
29

Hours
16

Mintues 23

Then you can deal with if mintues =>60 hours=hours+1 and minutes = minutes-60

2007-03-18 14:37:11 · answer #2 · answered by Anonymous · 0 0

fedest.com, questions and answers