?
Solved

custom datetimepicker date on another tab page not shown correctly

Posted on 2008-10-30
3
Medium Priority
?
611 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 200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
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…
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…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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