Time range that gets split (VB6)

Hi,

I've got two Times, start and end, and I'm trying to create a function where I pass in two other time parameters start1 and end1, the idea being that start1 and end1 get taken out of the original time ranges and after a few function calls I'm left with a few ranges that are excluded from the parameter times. For example:

Start time: 00:00
End time:   23:59

S1: 08:30
E1: 09:00

S2: 09:00
E2: 10:00

S3: 13:00
E3: 17:30

So the new times I'd have would change from 00:00 to 23:59 to these times:

Start1: 00:00:
End1:   08:30

Start2: 10:00
End2:   13:00

Start3: 17:30
End3:   23:59

I don't have any ideas on how I could implement this nicely - any ideas would be appreciated! :)

Thanks,
Uni
LVL 3
Unimatrix_001Asked:
Who is Participating?
 
Antagony1960Connect With a Mentor Commented:
Value is definitely a property of the date/time picker. I suggest you remove the form from your project, re-extract the form from the zip file and then re-add it to you your project. It should work then. If not, post exactly what the error message is saying.
0
 
Louis01Commented:
Hi Uni

Some questions:
What kind of structure is the range you have in? A table, variables, array?
What kind of structure should the output be in?
Would it always be three sets?
Say S1 = New start time or E3 = new End Time or both; how should this be handled?

Thanks
Louis
0
 
Unimatrix_001Author Commented:
Hi Louis,

Thanks for the response.

1) There isn't a structure at the moment. I've got two Date variables which indicate the start and end time.

2) I'm not too worried, but I'd like each start and end time to be represented as a Date variable.

3) No, it will probably be around 20 sets, but it will vary.

4) This will never happen, as nothing will occur at midnight or one minute to midnight so I'm happy for something like that to be undefined.

Thanks,
Uni
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
Antagony1960Commented:
Funnily enough I'm planning to add a time range insertion function to an existing project of mine, but I've only really only started throwing it together and I've got other priorities at the moment. I've uploaded the form here if you want to check it out... it may give you some ideas.

It's very basic at the moment, I haven't even put any date/time variable in it yet... it's just using control arrays of Date/Time pickers configured for time ranges. The value of the added range is determined by the set values of the previous range, so it shouldn't be too difficult to adjust to your requirements. My plan (eventually) is to set the Max & Min values so that the user can't screw up the ranges and to tie the range "From" values in with the following range's "To" values--i.e. changing one automatically changes the other. As I say,it's very basic, but it may just set you on the right track.
0
 
Unimatrix_001Author Commented:
Thank you - I'll have a little look at it. It may at least give me a starting point. :)
0
 
Unimatrix_001Author Commented:
Hi Antagony, may I ask what version of VB you used here? The form object is a picturebox, yet the code refers to a ".Value" member, which doesn't exist in VB6?

Thanks,
Uni
0
 
Antagony1960Commented:
It's VB6 (SP6)  Check your Help¦About menu to see which service pack you're on. If you're not on SP6 you'll need get that from the MS website first, as the date/time pickers are from the "Microsoft Windows Common Controls-2 6.0 (SP6)" components bundle. It's probably a good idea to be up to date with the latest service pack in any case.
0
 
Unimatrix_001Author Commented:
Hi Antagony, I can't seem to get this working - would you mind giving me an overview of how things are working in your program?

Thanks,
Uni
0
 
Antagony1960Commented:
Well it's really very simple at the moment, when a range is added it places a second set of date/time pickers underneath the last set (maximum 8 ranges at the moment) and sets their time values according to the values in the previous set and also changes the value of the previous range's "To" picker.

To2=To1
From2=From1+1min
To1=From2.

It really would be easier if you could get it working so that you can see for yourself. You can download SP6 here. But even if you can't get SP6 on your system at the moment, you should still be able to add the earlier (maybe buggy) date/time picker components to your toolbox, as they've been bundled with VB6 since its release (under "Microsoft Windows Common Controls-2 6.0").

Place one picker on the form and set the following properties:

Name: dtpFrom
Format: 3-dtpCustom
CustomFormat: HH:mm
UpDown: True

Copy and paste the first picker, saying "Yes" to control array

Rename the second picker to dtpTo and set its Index property to 0

Place them under the From & To labels (their Top properties should be 480) and it should run.

0
 
Unimatrix_001Author Commented:
I've got hold of SP6 and have added them to the VB form, but it is still getting a bit upset with the .Value property...
0
 
Unimatrix_001Author Commented:
Actually, can you take a look at my new question - I should be able to get a good idea from what you've put to make it into Date objects:

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_23901800.html

Thanks,
Uni
0
 
Unimatrix_001Author Commented:
Cheers. :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.