Solved

custom datetimepicker date on another tab page not shown correctly

Posted on 2008-10-30
3
602 Views
Last Modified: 2012-05-05
I have created a custom datetimepicker control - basically to make the presentation better when having no date set as well as a couple of other considerations.  This control works beautifully IF THE CONTROL IS IN VIEW/DISPLAYED/VISIBLE TO THE USER.
If I try to change its value (DTP1.Value = "8/3/2008") with the control not displayed (eg if DTP1 is on another tab page and not currently shown) then its OLD VALUE IS BEING DISPLAYED when I return to the control.  (On further testing, it turns out the .Value of the control IS the correct value ("8/3/2008 in this example) but the displayed value is not correct.)
Of course, I can write a crazy hack which temporarily shows the DTP control whilst I change its value, but that is soooo messy -- there must be a way to force my custom DTP control to show the new date value even though it is not currently in view.
Thanks in advance...
0
Comment
Question by:Sigh_Man
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Assisted Solution

by:jake072
jake072 earned 50 total points
ID: 22926059
Have you tried doing a .Refresh after you set the value?

Jake
0
 
LVL 1

Author Comment

by:Sigh_Man
ID: 22981963
Hi there
Sorry for the delay.  I tried .Refresh.  I tried everything I could think of like Invalidating the control (to force redraw) but nothing seems to work.
After some reading on the net, I discovered that this is a bug in the framework 2.0.  Custom format datetimepickers do not change their displayed date if they are contained within a tab page if their value is set whilst their owning tab page is not visible.
Of course, I wrote a disgusting hack which momentarily "selects" the relevant tab page whilst the DTP's value is set and then reverts to the original tab page again afterwards.  The result however is a screen flifker whilst the tab page selection changes - compounded by the fact that I have several tab pages in the same control so I have to iterate through each.  Not pleasant, and I will be re-working this solution before clients get it!  :D
0
 
LVL 1

Accepted Solution

by:
Sigh_Man earned 0 total points
ID: 22983057
Sorry I cannot locate the webpages where I saw this issue mentioned.  Basically, the fix is:
DON'T USE CUSTOM FORMATS IN YOUR DATETIMEPICKERS IF those DateTimePickers are located on tab pages and those DTPs are to have their values changed whilst their 'owner' tab page is not visible at the time of the Value Change.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question