Solved

From To for selecting times

Posted on 2014-04-21
7
161 Views
Last Modified: 2014-04-21
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?
0
Comment
Question by:al4629740
  • 4
  • 3
7 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 40013272
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
 

Author Comment

by:al4629740
ID: 40013285
DTPicker has a calendar that pops up.  Is it possible to change the format to Time?
0
 

Author Comment

by:al4629740
ID: 40013286
Nevermind.  Found it
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40013359
Well done. Pleased that you are OK now.
0
 

Author Comment

by:al4629740
ID: 40013414
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
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 40013527
The number is in days, or part days.

How do you need to see it?
0
 

Author Comment

by:al4629740
ID: 40013704
in Hours
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now