DateTimePicker and the Checked property

G

Guest

I've got a database application that uses the DateTimePicker to display/edit a person's birthdate. I'd like to use the .Checked property to determine if I want to write the date to the DB, but the behavior isn't what I expect. It seems that if I check or uncheck the DTP checkbox, the .Checked property doesn't always reflect that status.

Ideally, when the box is checked and a date has been selected, I want to write the date to the DB. If the DTP is not checked, I want to write a NULL to the database. I'm checking the .checked property before I write to the DB and I find that it's not always reflective of the current state of the DTP checkbox.

If (dtpBirth.Checked) Then
<write the date to the db>
Else
<write null to the db>
End If

Any ideas as to what I'm doing wrong? (Win XP Pro, .NET1.1, VB, FYI)
Thanks!
Mike
 
H

Herfried K. Wagner [MVP]

* "=?Utf-8?B?TWlrZSBFYXRvbg==?= said:
I've got a database application that uses the DateTimePicker to
display/edit a person's birthdate. I'd like to use the .Checked
property to determine if I want to write the date to the DB, but the
behavior isn't what I expect. It seems that if I check or uncheck the
DTP checkbox, the .Checked property doesn't always reflect that status.

AFAIK, the checkbox is buggy, at least on some systems.
 

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