From To for selecting times

I am making a form in vb6.  Using DTPicker or anything else, what is the best method to have a dropdown box for selecting time?

I want to have a FROM and TO for selecting time.  And then I would like to calculate the time in a third textbox.

Any ideas?
al4629740Asked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
The best method will depend on many factors. Here is one way:
Private Sub Command1_Click()
    Text1.Text = DTPicker1.Value
End Sub
Private Sub Command2_Click()
    Text2.Text = DTPicker1.Value
End Sub

Private Sub Text1_Change()
    If IsDate(Text2) And IsDate(Text1) Then
        Text3 = CDate(Text2) - CDate(Text1)
    End If
End Sub

Private Sub Text2_Change()
    If IsDate(Text2) And IsDate(Text1) Then
        Text3 = CDate(Text2) - CDate(Text1)
    End If
End Sub

Open in new window

0
 
al4629740Author Commented:
DTPicker has a calendar that pops up.  Is it possible to change the format to Time?
0
 
al4629740Author Commented:
Nevermind.  Found it
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
GrahamSkanRetiredCommented:
Well done. Pleased that you are OK now.
0
 
al4629740Author Commented:
When I run the code, my output is always an odd number, such as

11:00:00 PM to 12:00:00 PM =  -0.91666666666

How do I get it to give me a number like 1 or 1.5
0
 
GrahamSkanRetiredCommented:
The number is in days, or part days.

How do you need to see it?
0
 
al4629740Author Commented:
in Hours
0
All Courses

From novice to tech pro — start learning today.