CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12

Thread: DateTimePicker problem

  1. #1
    Join Date
    Aug 2010
    Posts
    50

    DateTimePicker problem

    Hi. I've got a datetimepicker control on a vb .net 2008 form. I have set it to show a custom format of "dd/MM/yyyy". The problem is this:

    - when i click on the arrow button, a small calendar is shown in which i should be able to select a date. The only way i can do that is by using the arrow keys and pressing Enter. Clicking on any date value inside this calendar doesn't do anything.

    How can i make the value of the datetimepicker change to what i have clicked inside the dropdown calendar?

    Thank you

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: DateTimePicker problem

    Do you have all the service packs for vb 2008?
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  3. #3
    Join Date
    Aug 2010
    Posts
    50

    Re: DateTimePicker problem

    Yep. I made the project in framework 3.5. I've tried to select from the toolbox elements another version of datetimepicker(currently it showed 2.0 but in that list i also have a 3.5) but it didn't appear in the toolbox.

    I've also put a calendar control on the form and it looks and behaves differently than the one shown by the drop down of the datetimepicker(i can click-select the date, but i cannot integrate it in my form since it's larger than what i need). I should also mention that i cannot check or uncheck the "Enable application framework" option in the project properties. It's just greyed out even if i could do that when i made the project (i have no idea how to solve this stupid bug, and the application.designer file is always empty). I believe it has something to do with the datetimepicker problem since within a new project everything works fine.

    Any help is deeply appreciated. I know i could try a workaround of creating a Calendar control when i click the datetimepicker arrow (On_dropdown event if i remember right), but i'd rather solve this bug since i could have a much cleaner project overall.

    If everything else fails, could you tell me how can i import everything from a solution into a new one(hopefully without bugs)?

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: DateTimePicker problem

    You can tell VS to completely rebuild the toolbox from the options menu
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Aug 2010
    Posts
    50

    Re: DateTimePicker problem

    I tried that and still the 3.5 version DTP control doesn't show up, but only the 2.0 version one.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: DateTimePicker problem

    Add it manually. Or, remove and reinstall. Sounds like it may have had a problem
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: DateTimePicker problem

    Quote Originally Posted by Crusader2010 View Post
    Yep. I made the project in framework 3.5. I've tried to select from the toolbox elements another version of datetimepicker(currently it showed 2.0 but in that list i also have a 3.5) but it didn't appear in the toolbox.

    If everything else fails, could you tell me how can i import everything from a solution into a new one(hopefully without bugs)?
    Did you go to your Project Properties? In there somewhere shoul be an option to change the Target Frameowrk

    If that doesn't work, I may have bad news.... Try recreating the form, or even the project - remember to set the target framework as 3.5 in there as well, then copy all the code and stuff into your new form. Existing forms you can just add by selecting Project, Add Existing Item
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  8. #8
    Join Date
    Aug 2010
    Posts
    50

    Re: DateTimePicker problem

    Here's what i managed to find out:

    - the datetimepicker doesn't allow proper selection because it seems that XP visual styles are not enabled by default.
    - i made a new project, copied all the forms(with their designers and res files) into this folder, then opened it and imported them by using "show all files" in the solution explorer and clicking on "include in project". After this i could enable the framework and such. The "common" way of importing the forms didn't work because the VS IDE couldn't show me the forms' designers properly(there were no controls on them).

    It seems there are still some bugs with VS, but one question remains:

    Is there any way of enabling XP visual styles without the use of application framework from project properties?

    @HanneSThEGreaT: i tried the target framework from advanced compile options but that didn't change anything. The project and that target were on 3.5 all the time. I still have no idea what i've done for the "enable application framework" check box to become grayed out
    Last edited by Crusader2010; April 18th, 2011 at 12:41 AM.

  9. #9
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: DateTimePicker problem

    Quote Originally Posted by Crusader2010 View Post
    Is there any way of enabling XP visual styles without the use of application framework from project properties?
    Perhaps try a manifest file :

    http://www.google.co.uk/search?hl=en...&aqi=&aql=&oq=

    Quote Originally Posted by Crusader2010 View Post
    @HanneSThEGreaT: i tried the target framework from advanced compile options but that didn't change anything. The project and that target were on 3.5 all the time. I still have no idea what i've done for the "enable application framework" check box to become grayed out
    Me neither. This is weird. I'm starting to think re install....
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  10. #10
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: DateTimePicker problem

    That's what I said three posts back
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  11. #11
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,268

    Re: DateTimePicker problem

    Sorry, I didn't realize it was a competition...
    [SIGPIC][/SIGPIC]
    All my Articles
    Hannes

  12. #12
    Join Date
    Aug 2010
    Posts
    50

    Re: DateTimePicker problem

    Hi again. A little update: it seems somehow i have two versions of the datetimepicker control.

    One of them is showing only an arrow on the right side of the control (that opens the calendar), while the other one is showing an arrow + a little calendar. The latter is in my toolbox and is the one that doesn't allow click-selection of dates within the drop-down calendar.

    I've tried removing the control from the toolbox and such but i just can't get hold of the first version with only a simple arrow (good thing i had it on my form and could copy it). Anyone has any idea about this? How can i get hold of the two versions, and how can i find out the version of a control on my form?

    (I have reinstalled VS 2008).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)