VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

Sponsors


More...


DatePicker Code

DateTime PickerSpecial thanks to Piet De Booser for providing this sample codePiet is a consultant in Belgium currently working on advanced VBCE solutions.

A frequent question appearing in the Microsoft VBCE newsgroups and VBCE WebBoard is how do VBCE developers create a Date Time picker?  Unfortunately, creating this control in VBCE is all but impossible with the severe limitation of not being able to use UDT's.


Download Code!

Notes from the author
At this time it is in an immature state, but one can still look at to see how one can create a date picker in VB itself.

Take care for following issues
- the combobox is made up of a textbox with a normal command button, to get the down arrow on the down button I used the wingdings 3 font, it is included in the zip file and you will need to copy it to \Windows\fonts\windng3.ttf

- there are two fields that can initiate the datepicker, one is the lookalike combobox and the other one is the normal sized textbox.

- if you click in the textbox or on the downarrow of the combo the datepicker will appear

- the picker itself works rather well but there are still things I have to look into

- the code is not yet completely cleaned up and there is not a lot of comment in

- if you click on the left or right arrow the calendar will go up (down) one month at a time even is the months are displayed

- when clicking on the year or on the monthname a list of months will appear

- the up and down scroll keys will scroll the year, if you keep on pressing the up (or down) scrollbutton the year will keep on scrolling so you don't have to push these buttons time after time

- clicking in the white space of the calendar will loose the focus of the current day

- the control from where the picker start has some limitations, if you format the date with a long date format and have a date filled in and then click on the box to show the calendar an error will occur. This is caused by a bug of VBCE, I do not have a workaround yet.

- the combox will always show the calendar with todays date

- if the calendar is shown and you click on another calendar enabled control the calendar will disappear until you click the control a second time

- if the calendar is shown and you do not wish to select a date, just click somewhere on the form and the control will be hidden without selecting a date

- currently there is nothing to clear a filled in date field.

- the blue background color is currently a fixed color (it will work on a grayscale device) but if you change the colors of your device it will still be blue, I'm not sure if I can change this because I use a bitmap for a part of the control

- the most unpleasant part is that it is not an acitvex control but vb code so you will need to include on every form where you need it (you need a timer, a picturebix, a bitmap, an extra label and a listbox)

I release this code as freeware in the state it is now because I think I cannot enhance in the next few weeks, once I have updated this control I will post it on VBCE.COM. So people are free to use this code, I can only ask for a credit in commercial programs.

Pieter De booser
CRONOS NV
Veldkant 35d
2550 KONTICH (BELGIUM)
september 8 1999


VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!