DateTimePicker - Setting selectable days

P

Paul G. Tobey [eMVP]

Chris,

Sorry to say, I've never used the control myself, but one thing you might
try is to catch selection of a date and, if it's not one of the days you
want to allow, change the selection programmatically to the nearest one you
*will* allow. It's not as good an interface as disabling all the other
days, but it might work.

Paul T.
 
C

Chris Theorin

Thanks for the suggestion Paul.

I'll have to examine this further to see if it makes sense or just ends up
being too confusing for the end user :) D

-Chris
 
T

Tim Wilson [MVP]

The built-in (system) DateTimePicker that you are using, via a PInvoke
wrapper, does have the ability to force the user to select between two dates
(MinDate and MaxDate). You can see this if you try using the DateTimePicker
in a .Net desktop application. So if you can live with allowing them to
select a range of continuous days then you should be able to do this by
making some modifications to the source code for the wrapper. But if you
want them to be able to select dates that are not "side-by-side" then you
are really on your own here. Although it doesn't really sound like you need
all the features of a DateTimePicker, you could look into the fully wrapped
DateTimePicker here (http://www.intelliprog.com/netcf/dtpicker.html) to get
access to a .Net PPC control that has MinDate and MaxDate.
 
C

Chris Theorin

Thanks Tim!

You're definately right that I don't need all the features of the DatePicker
here... but I'm aiming for UI consistency regardless of the "state" of the
application here:
1) When wireless I can request data for any date
2) When not wireless I want to only be able to select dates with cached
information

:) D
-Chris
 
T

Tim Wilson [MVP]

That sounds a little outside of the idea behind the MinDate and MaxDate
properties as it appears that you might need to be able to select dates that
are not side-by-side. Have you considered simply putting the names of months
in a combobox and having a secondary combobox with the number of days in the
selected month. So when the user selects January (for example) you can make
sure that the second combobox has values 1-31 as possible selections (or in
this case only the dates that are cached). Since it sounds like the user is
only supposed to select one date at a time anyways this might be a
respectable solution (and easy).
 
C

Chris Theorin

My original post was to get away from using a ComboBox, let alone mutliple
ComboBoxes. I'm usually dealing with a number of dates which are mangeable
in a single combo box... just going for GUI consistency when all days are
available (wireless) and when only some days are available...

I guess letting users click a day in cached mode with no information isn't
much different than them clicking a day in wireless mode with no
information... just seems like a waste for them to possibly select a date I
know will not have any chance of having information.

No biggie and thanks for the suggestions guys!

-Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top