Access DS TextBox - wrong value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I format a DataSet (DS), generated from Access, which loads a Textbox
(TB) to only show the date in the TB instead of the date and the time?

Details:
My TB is filled by a DS containing the Date column from an Access file (i.e.
DS - TableName.DateIn). Access file only shows date (no time). Originally,
this date column was a string so I
1. Changed the column DataType in Access to a Date/Time
2. Changed Visual Studio DS schema and selected Date for field

I've tried things like mm/dd/yyyy and "short date" in Access format field
for column.
 
Steve,

You can format the date by Converting the row in the data set to a date time
and then use the invariant DateTimeFormatInfo to format the string. I have
pasted some sample code below.

I hope this helps!
 
I don't think that's what the OP wants, rather, he would like to be able
to specify in the binding how to do this.

In .NET 1.1, you should just hook up to the Format event on the Binding
instance for your property that is bound to the date. You will be able to
specify the format or perform it yourself here, and have the date come out
correctly.

In .NET 2.0, it gets easier, by setting the FormatString property on the
Binding instance that manages the binding between the data source and the
control.

Hope this helps.
 
Nicholas,

Now that I look at the question again I think you may be correct. I believe
what caught my eye was the formatting string at the end of the author's
message. At the very least multiple ways are covered and (hopefully) the
original author will now have his pick! ;-)

Cheers
 
Thank You, Thank You

I think Brian answered my question but I think I can implement it the way
Nickolas is suggesting during a Format event (collectionchanged_event ??,
textChanged?) if I understand your answers

I wanted to state something like this in the VS property window:
dataset - TableName.DateIn(mm/dd/yy)

My concern is I have Update() dB with correct datatype fro the TB. I didn't
know if the time was coming from the DS or Access (e.g. my last statement in
post). Although, I thought I fixed it because I indicated "date" in the DS
schema and not "datetime"

Steve
 
Back
Top