Hi, I'm writing an application in which I need to log the start and end times of an event and the subsequent difference in time time measured in seconds. I have used text boxes for the times (1 for hour, 1 for min etc). Then when all is completed, I check all the boxes and work out the times.
Ideally I just take the start units from the end, and if the result is less than zero, ie starts at 23:58:01 and ends at 00:12:34 then I effectively add 24hours to get the number. However, this doesn't even come into question because unless there is only a few mins difference and the start hour is less than the end, then I get overflow errors.

**
My assumption was that "integer" was < 32k (two bytes) and that "long" was <2b (four bytes).

If this is the case, why do I get overflow errors when a "long" variable is assigned to 86k ??
If long is not 4 bytes, how do deal with decently large numbers ? Does VB have an unsigned long or some other way of manipulating large numbers.


Code Extract:
lngSum = ((CLng(txtFH) - CLng(txtSH)) * 3600) + ((CLng(txtFM) - CLng(txtSM)) * 60) + (CLng(txtFS) - CLng(txtSS))
lngDay = 24 * 3600
If lngSum < 0 Then
lngTotal = lngDay + lngSum
Else
lngTotal = lngSum
End If

MsgBox lngTotal 'Only here as a debug


Thanks