1 – 7 of 7
Blogger Ad said...

I need to avoid typing slash as well. If the user enters two digits in month, then the mouse should automiatically move to the Date portion. Pl let me know how to handle this?

08 September, 2009 00:14

Blogger Yakko Warner said...

As far as I know, the standard DTP control doesn't support this, so it won't be trivial. You might try seeing if you can hook into the KeyDown or KeyPress events on the control, count characters, and when two characters are typed, do a SendKeys to send the CurrentUICulture.DateTimeFormat.DateSeparator character.

I don't know if it will work, but it's something to try.

08 September, 2009 10:29

Blogger Unknown said...

Thanks for this code :) I also noticed that if a cell is null when you go into edit mode an exception is thrown. Added a simple IIF statement to resolve:

In CalendarCell.InitializeEditingControl:

ctl.Value = CType(IIf(Not IsDate(Me.Value), Now, Me.Value), DateTime)

16 October, 2009 14:29

Blogger Yakko Warner said...

Thanks for the comment! I added similar code when I expanded this into a checkbox-enabled, nullable CalendarColumn. Good to know I wasn't just being paranoid. ;)

16 October, 2009 14:40

Blogger Unknown said...

Thanks for spotting these fixes, good work.

For the Null value, what if i don't want to insert today's date if it's null? What if i'd just like to leave the cell blank and DB value still null?

Thanks

01 January, 2010 04:57

Blogger Yakko Warner said...

Check the nullable column example I linked to in my previous comment (it's something I worked on later). It lets you enable the checkbox on the date control to blank out dates and insert DBNull into the underlying data source.

01 January, 2010 13:46

Blogger Unknown said...

I have a row with two CalendarCell: First cell not nullable but second one is nullable.
If I click in in nullable cell, I let it unchecked then I click on the first cell. As result, I loose the selected value in combobox (Cell.Value should be selected).

When I have my second cell checked , I don't have this problem.

I cannot understand what's happening. help will be appreciated.

Thanks

17 March, 2011 04:34

Your civil comments are appreciated. Thanks!
You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot