Date Picker wil not be visible

J

JayDe

Hi

I have a form with the Microsoft Date and Time Picker Control 6.0 (SP 6)

When I initilize the firm i have something like this in my code:

DateFrm.ValDate.Visible = False

and when the form is showing this control is of course not showing.

Later in my code I have this statement

DateFrm.ValDate.Visible = True

The problem is that the control is also not showing this time

Any idea of what can be the problem.

Regards
JayDe
 
R

RB Smissaert

After this line:
DateFrm.ValDate.Visible = True

Put this:
DoEvents

and see if that makes a difference

If not then do:
DateFrm.Repaint


RBS
 
J

JayDe

Sorry

This did not solve the problem.

The funny thing is that I am showing and hiding many controls, but the
datepicker is the only one that is not showing. The only difference is that
the datepicker is an "Additional Control"


JayDe
 
R

Rick Rothstein

I get the same problem (I'm using XL2003 SP3 on Vista SP1). Here is a work
around that you can use (at least until someone comes up with a better
method) where I have used a CommandButton Click event to represent the
showing of the control later on in your code...

Dim DatePickerLeft As Long

Private Sub CommandButton1_Click()
DateFrm.ValDate.Left = DatePickerLeft
End Sub

Private Sub UserForm_Initialize()
DatePickerLeft = DateFrm.ValDate.Left
DateFrm.ValDate.Left = 2 * Me.Width
End Sub

Note the DatePickerLeft variable is declared outside of any procedure...
this makes the variable "global" to the UserForm. The concept is to move the
control out of view (off the visible part of the UserForm) when the UserForm
initializes and to move it back into its design time position when you want
the user to see it again. If you want to remove it from view later on in
your code, just set the Left property as I did in the Initialize event to
move it out of view again.
 
R

RB Smissaert

Another option might be to put the datepicker on a frame exactly the same
size as the datepicker (or a bit bigger if you want)
and make the frame visible and not visible. The datepicker itself is always
visible and that property will never be altered.

RBS
 
R

RB Smissaert

Another option is to go with the MonthView control (SP6) that is in
MSCOMCT2.OCX.
This always worked fine for me and no problem with visibility.

RBS
 
J

JayDe

I did it with the frame solution.

it was very simple to do and it worked perfect.

Thank you


Regards
JayDe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top