 |
| View previous topic :: View next topic |
| Author |
Message |
MiniMe Newbie
Joined: 29 Dec 2003 Posts: 1
|
Posted: Dec 29th, 2003 08:22 AM Post subject: Hi guys, can anyone help me?? |
|
|
Hi guys,
I'm currently working on producing a timetable-like fixtures grid, which consists of a control array with slots for the various times and days of the week... however I've become a little stuck with the drop and drag when it comes to displaying the correct time for the representative slot.
slfr - represents selected slot (from)
slto - represents selected slot (to)
slto - is an index (start drag)
dto - is an index (end drag)
The number 16 as shown below is indicative of the number of vertical slots, ranging from 12:00 through to 1:30 every half hour, with four slots representing each time period. This is shown below, with the times being labels:
Monday Tuesday Wednesday Thu..
12:00...........|..........|...............|.......
12:00...........|..........|...............|.......
12:00...........|..........|...............|.......
12:00...........|..........|...............|.......
12:30... etc
12:30
12:30
12:30
13:00
13:00
13:00
13:00
13:30
13:30
13:30
13:30
bsl = slfr - (Int(slfr/16)) * 16 ' 16 = number of vertical slots
hour = str$(12 + Int(bsl/2)) ' 12 = start time
if bsl/2 = Int(bsl/2) then
m$ = ":00" else m$ = ":30"
m$ = str$(hour) + m$
dfr = dfr + " at " + m$
bsl = slto - (Int(slto/16)) * 16
hour = str$(12 + Int(bsl/2))
if bsl/2 = Int(bsl/2) then
m$ = ":00" else m$ = ":30"
m$ = str$(hour) + m$
dto = dto + " at " + m$
The above code produces the following:
12:00
12:30
13:00
13:30
14:00
14:30
etc... however, I need this to be duplicated '4x' for each time period
Can anybody guide me in the right direction??
Many thanks,
MiniMe |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Dec 29th, 2003 10:31 AM Post subject: |
|
|
First off, I'm assuming you misstyped this?....it should be
slfr - represents selected slot (from)
slto - represents selected slot (to)
dfr - is an index (start drag)
dto - is an index (end drag)
:$ right?
and your just looking to produce the text version of the times 12-13:30 ? This would be simple in itself:
| Code: |
startTime = #12:00:00 PM# ' [#] declares the variable type as a date/time
For i1 = 1 to 4
For i2 = 1 to 4
'output here...I'm going to send it to the immediate window
' because I don't know where your sending it
strOutput = Format (startTime, "hh:mm")
Debug.Print strOutput
Next i2
startTime = DateAdd("n", 30, startTime) ' [n] increments the minutes of a date/time variable
Next i1
|
This will display 4 lines of 12:00, then 4 lines of 12:30 and so on...
Does this help any? You will have to adapt it to work with your code, but I think it's what your asking for. _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
Andir Centurion

Joined: 21 Dec 2003 Posts: 184 Location: Chicago Area
|
Posted: Dec 29th, 2003 10:47 AM Post subject: |
|
|
I guess what I'm looking at is your not showing your loop, I see the output from your code might produce an error. Your looking to generate text like this?
Monday at 12:00
Monday at 12:00
Monday at 12:00
Monday at 12:00
Monday at 12:30
Monday at 12:30
Monday at 12:30
Monday at 12:30
...
Setting the control index dto and dfr = dto + something will produce strange results if any.
You could change what I had above to be like this...
| Code: |
startTime = #12:00:00 PM# ' [#] declares the variable type as a date/time
For i1 = 1 to 4
For i2 = 1 to 4
'output here...I'm going to send it to the immediate window
' because I don't know where your sending it
strOutput = object(dto).Caption & " at " & Format (startTime, "hh:mm")
Debug.Print strOutput
Next i2
startTime = DateAdd("n", 30, startTime) ' [n] increments the minutes of a date/time variable
Next i1
|
where object(dto).Caption is the control your dragging to. I'm still having a bit of trouble seeing where your going. Is this being dumped to a text box or file? _________________ If you happen to see little people sitting on your desk...don't tell anyone or they might think your crazy too. |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|