NULL dates show today's date rather than a blank or NULL on form

M

M Skabialka

I am creating my first Visual Studio project, an inventory database. I have
created a form and used written directions to add data from a table to the
form using table adapters, data sets, etc.

I imported a table from an Access database which has some date fields. Many
of these dates have never been filled in, so are nulls. If I look directly
into the table data from Visual Studio it shows NULL.

However, when I scroll from record to record on the form, any date field
which should be NULL shows today's date, though it doesn't change it to that
date (thank goodness!).

Each date field has also been created on the form automatically as a
calendar drop-down box - is this why there is a default date of today? I
would rather show NULL or blank, e.g. one of the dates is a disposal date,
and the item is not disposed of yet.

How can I change the property on this field to show a blank or the word NULL
rather than today's date? Which property is this, and where? The form, the
table, the TableAdapter???

Thanks,
Mich
 
T

Tim Patrick

The DateTimePicker control includes a ShowCheckBox property that lets you
turn date selection on and off with a checkbox. Try setting this field to
True. I haven't tried it with data binding, so I'm not fully sure it will
meet your needs.
 
C

Cor Ligthert [MVP]

Jono

It sound a little bit strange.

Why not create a temporaly project and use a form with a datagridview on it.

Set the datasource in that to your table and see what it shows.

Cor
 
M

M Skabialka

All that does is enable or disable data entry on this field. It still puts
today's date there instead on a blank or NULL entry, which is valid in this
case.
 
T

Tim Patrick

Unfortunately it is a limitation in the DateTimePicker control that it always
shows a date no matter what. I've bumped up against the issue myself, although
since I don't use data binding, I have more control over the situation.
 
M

M Skabialka

All date fields which have no data in them show as blanks in the datagrid
view, which is what I want, but I don't want to work from a datagrid. How
can I change the dates to not be DateTimePicker controls, but just regular
data entry fields?

Mich
 

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