473,569 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DateTimePicker and visibility to Min/Max Dates.

Greetings group,

I have a situation where I'd like to visibly see disabled dates on a
DateTimePicker. Frequently the Min and Max dates in the picker will be
set only to days apart, and so I would like this to be reflected in a
way other than it simply failing to select when they click. It seems
like this would be doable with a MonthCalendar control, however the
DateTimePicker itself doesn't seem to expose an internal MonthCalendar,
nor does it provide any kind of hihglighting options.

I'm open to any/all crazy suggestions. :)

Chris.
Sep 21 '07 #1
12 7271
Hi,

"Chris Shepherd" <ch**@nospam.ch sh.cawrote in message
news:uA******** ******@TK2MSFTN GP06.phx.gbl...
Greetings group,

I have a situation where I'd like to visibly see disabled dates on a
DateTimePicker. Frequently the Min and Max dates in the picker will be set
only to days apart, and so I would like this to be reflected in a way
other than it simply failing to select when they click. It seems like this
would be doable with a MonthCalendar control, however the DateTimePicker
itself doesn't seem to expose an internal MonthCalendar, nor does it
provide any kind of hihglighting options.

I'm open to any/all crazy suggestions. :)
IIRC you can control how each cell will looks like in the control. You
could set the CssClass to a style that the text is not visible. So it will
be "invisible"
Sep 21 '07 #2
OZI

This must be for a WinForm, I don't see CssClass.
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:uX******** *****@TK2MSFTNG P06.phx.gbl...
Hi,

"Chris Shepherd" <ch**@nospam.ch sh.cawrote in message
news:uA******** ******@TK2MSFTN GP06.phx.gbl...
>Greetings group,

I have a situation where I'd like to visibly see disabled dates on a
DateTimePicker . Frequently the Min and Max dates in the picker will be
set only to days apart, and so I would like this to be reflected in a way
other than it simply failing to select when they click. It seems like
this would be doable with a MonthCalendar control, however the
DateTimePick er itself doesn't seem to expose an internal MonthCalendar,
nor does it provide any kind of hihglighting options.

I'm open to any/all crazy suggestions. :)

IIRC you can control how each cell will looks like in the control. You
could set the CssClass to a style that the text is not visible. So it will
be "invisible"

Sep 21 '07 #3
OZI
Are you saying MinDate and MaxDate properties will not do it for you?
"Chris Shepherd" <ch**@nospam.ch sh.cawrote in message
news:uA******** ******@TK2MSFTN GP06.phx.gbl...
Greetings group,

I have a situation where I'd like to visibly see disabled dates on a
DateTimePicker. Frequently the Min and Max dates in the picker will be set
only to days apart, and so I would like this to be reflected in a way
other than it simply failing to select when they click. It seems like this
would be doable with a MonthCalendar control, however the DateTimePicker
itself doesn't seem to expose an internal MonthCalendar, nor does it
provide any kind of hihglighting options.

I'm open to any/all crazy suggestions. :)

Chris.

Sep 21 '07 #4
Hi,

"OZI" <sq**********@h otmail.comwrote in message
news:ee******** ******@TK2MSFTN GP06.phx.gbl...
>
This must be for a WinForm, I don't see CssClass.
My bad, I though it was for a web app.

But still the idea is valid, just to try to have the same color of the
font/background in the needed cells.
Sep 21 '07 #5
OZI wrote:
Are you saying MinDate and MaxDate properties will not do it for you?
Nope, try it yourself. Just add a DateTimePicker and a MinDate and
MaxDate, and for me, by default, it simply means the user can't click
those dates once the MonthCalendar control has dropped down. Visibly
there isn't a difference between a valid date in the current month and
an invalid date in the current month.

Chris.
Sep 21 '07 #6
Ignacio Machin ( .NET/ C# MVP ) wrote:
IIRC you can control how each cell will looks like in the control. You
could set the CssClass to a style that the text is not visible. So it will
be "invisible"
This isn't a web control, but a WinForms control.

Chris.
Sep 21 '07 #7
Ignacio Machin ( .NET/ C# MVP ) wrote:
My bad, I though it was for a web app.

But still the idea is valid, just to try to have the same color of the
font/background in the needed cells.
The trouble is visibility to those cells.

Chris.
Sep 21 '07 #8
OZI
Yes the Idea is valid in theory and thin air. I don't see how to control
each individual day format.
It is not available like on in the web control.
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions .comwrote in
message news:eK******** ******@TK2MSFTN GP04.phx.gbl...
Hi,

"OZI" <sq**********@h otmail.comwrote in message
news:ee******** ******@TK2MSFTN GP06.phx.gbl...
>>
This must be for a WinForm, I don't see CssClass.

My bad, I though it was for a web app.

But still the idea is valid, just to try to have the same color of the
font/background in the needed cells.

Sep 21 '07 #9
OZI
Okay so what you want to do with the invalid dates is to make them
invisible.
There must be a way to override the rendering, but I don't see how now.
"Chris Shepherd" <ch**@nospam.ch sh.cawrote in message
news:OP******** ******@TK2MSFTN GP03.phx.gbl...
OZI wrote:
>Are you saying MinDate and MaxDate properties will not do it for you?

Nope, try it yourself. Just add a DateTimePicker and a MinDate and
MaxDate, and for me, by default, it simply means the user can't click
those dates once the MonthCalendar control has dropped down. Visibly there
isn't a difference between a valid date in the current month and an
invalid date in the current month.

Chris.

Sep 21 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1404
by: Tom Rahav | last post by:
Hi. I have a DateTimePicker on a win form in VB.NET 2003, and I have a database table that contains different dates as records. What I want to do is detect what dates are exist in the database, and mark then on the DateTimePicker. Does anyone know how can I mark a specific date in the DateTimePicker (which is not the current date)? ...
9
3943
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine...
7
8457
by: Edward Mitchell | last post by:
I have a number of DateTimePicker controls, some set to dates, some set to a format of Time. The controls are all embedded in dialogs. I created the controls by dragging the DateTime picker from the Toolbox and then set the Format property appropriately. I have noticed that sometimes the Time format will reset spontaneously to Short Date. ...
3
3244
by: Jeronimo Bertran | last post by:
Is there any edit box type control that allows dates to be entered? Something similar to the DateTimePicker in Windows Forms? Thanks, Jeronimo
1
997
by: Brett Baisley | last post by:
Hello I am using two datetimepicker controls to allow the user to select two dates. I've called them dateIn and dateOut. After they pick the dateIn, I want to set its Leave method to automatically set the date of dateOut to whatever was selected in dateIn + 2 days (as this will be the most common selection for the second date). I tried...
2
5052
by: Atley | last post by:
Is there a way to use the DateTimePicker to pick a time or is it just used to pick dates? If so, why is it called DATEtimepicker?
2
3372
by: Chris Fairman | last post by:
NG, Maybe I'm missing a key step, but it seems when typing dates into a DateTimePicker control (format = 'Short'), the controls' .text property is not updated until the control losses focus. I'm handling an <enter> key event on a DateTimePicker control. Essentially I want to give a user the ability to type a date in the DTP, and press...
1
3129
by: Jesse | last post by:
Hi, I am working on datetimepicker and want make the dates out of my range disabled. There are APIs that I have used: minDate, maxDate. It works fine. However, users can not tell which date can't be selected as the dates in the dropdown are with the same color. This is not kind to user. I want to make the dates out of the selectable range...
2
5215
by: Todd Carnes | last post by:
I am trying to write an app in C# that requires the user to enter a date from 4000 B.C.E to 4000 C.E. I tried to use the DateTimePicker Control to allow the user to enter the date, but it only supports the Gregorian Calendar, so the earliest date it allows is in 1752 C.E. Is there a way to override the DateTimePicker control's minimum...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.