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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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
Antagony1960Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Unimatrix_001Author Commented:
Cheers. :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.