Date Time Picker

D

Dave

I'm update a form someone else created. I added a
DateTimePicker control to the form and I want it to
default to the current date everytime someone loads the
form. I've tried using DTPicker1.value = Date in the form
load event and I get the error:

Run-tim error '2763':
DTPicker returned the error: An error occurred in a call
to the Windows Date and Time Picker control..

Also if I try and set the MinDate and MaxDate values in
code I always get an error message saying that the date is
in the incorrect format. I've tried every date format I
can think of without any success.

On one of the forms I created from scratch I am able to
set the DateTimePicker control value in the form load event
and set the MinDate and MaxDate values
 
G

Gene

Try

DTPicker1.value = Now()

And I am not sure but you may have to put this code in the FormOpen event.


Hope this helps
Gene
 
D

Dave

Thanks for the reply Gene

I have tried using,

DTPicker1.Value = Now()
DTPicker1.Value = DateTime.Now()
DTPicker1.Value = "06/03/2003"

And every other way I can think of to input a date. It
doesn't want to accept anything. I'm wondering if it
might be a reference problem. I made sure that I put the
code in the FormLoad event. I've been working on this
problem on the side for a week now and I'm all out of
ideas.

Dave
 
D

Dan Artuso

Hi,
Just for the heck of it,
put:
DTPicker1.SetFocus
DTPicker1.Value = Now()
See if that changes anything.
 
D

Dave

Thanks Dan,

I now understand why I doesn't set the value. The Date
Time Picker is located on the last Tab on a Tab control.
However the problem now is how do I set it's value to the
current date in it's present location?

Dave
 

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