Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic restricting the controls on appointment form (Read 2568 times)
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
restricting the controls on appointment form
Feb 7th, 2008 at 11:11am
Print Post  
I can see now why I started down the road to create my own appointment form so that I would have full control, but that caused me more problems than it was worth!

Anyway I am using the built in appointment form and have hidden the enddate control so the user can only select the start date and start and end times.

I need to restrict the date as follows:

The appointment date can only be as displayed in the startdate control and the times must range between 07:00 and 18:00.

I have set the startdate control to allow only dates in the present and the time range as above.

However the endtime control will not allow me to set its time range as I presume as I scroll thru the times the invisible enddate control is allowing it to go to another date.

Can you advice how I restrict the enddate to match the date displayed in the startdate each time the startdate control is updated and restrict the endtime control to range from 07:00 to 18:00 but restricts the time being earlier than the starttime?

Painful I know, but this is what I could do in my custom form.  But the custom form meant I lost all the functionality of the recurrence bits

Thanks













  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: restricting the controls on appointment form
Reply #1 - Feb 7th, 2008 at 11:51am
Print Post  
You can use the MinDate and MaxDate properties of the DateTimePicker control in order to limit the dates and times that can be selected within it.

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: restricting the controls on appointment form
Reply #2 - Feb 7th, 2008 at 5:18pm
Print Post  
I know but from how can I set the end date to match the start date to restrinct the date to a single day?

If the form opens and the controls are as follows:

Start date = 25/02/2008  Start Time = 08:00

End date = 25/02/2008 End Time = 08:30

And the user changes the start date to 27/02/2008
the controls will then be as follows:

Start date = 27/02/2008  Start Time = 08:00

End date = 25/02/2008 End Time = 08:30

Does not make sense does it?

I need the date restricted to a single day.

If the form was my own I would modify the changed event of the start date control so that each time it changed the end date control would be changed to match it.

But it is the built in appointment form I am using so cannot do this.

I have tried to intercept this after the appointment form closes and setting the end date and time as follows:

Code
Select All
app.EndTime = New DateTime(app.StartTime.Year, app.StartTime.Month, app.StartTime.Day, app.EndTime.Hour, app.EndTime.Minute, app.EndTime.Second)
 



but as I have no control or cannot see what code is behind the Save & Close button by the type the form has closed and gets to my code the app.startdate.day has been reset back to 25/02/2008

Do you understand my problem now?

Sad























  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: restricting the controls on appointment form
Reply #3 - Feb 8th, 2008 at 6:49am
Print Post  
You can handle the ValueChanged event of the time controls and perform the necessary checks to ensure that start time is less than end time.

Meppy
  
Back to top
 
IP Logged
 
elpuerco
Junior Member
**
Offline


Time?  What's time matta
to a pig?

Posts: 94
Joined: Oct 2nd, 2007
Re: restricting the controls on appointment form
Reply #4 - Feb 8th, 2008 at 10:33am
Print Post  
did not realise I could add a hanndler to controls on forms I did not create ... i do now  Grin

Thanks

Wink
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint