DataSet Textbox Time

G

Guest

Using: VS
dB: MS-Access

Although the the DataGrid displays the proper date from an Access file
(Date/Time DataType) an adjacent bound textbox for that same DataGrid field
displays the date and the time (e.g. 12/7/04 12:00 AM).

How do I get rid of the time from textbox and show only the date?

1. VS textbox Properties:
(DataBindings)-TextBox: fooDS - TableName.DataIn
2. I've chanded the DS schema to Date
3. Access Format for column says: mm/dd/yyyy

Steve
 
M

MikeY

Hi Steve,

Hope this exerpt from my code helps.

public void SetTime()

{

DateTime myDateTime = DateTime.Now;

// this.txtBoxOutput.Text = myDateTime.ToString("dddd MMMM dd hh:mm:ss");

this.txtBoxOutput.Text = myDateTime.ToString("dddd");

}



For the blocked out part of the code, you can see that you can manipulate
the desired part of the time/date/etc that you want.

MikeY
 
G

Guest

I think you might also be able to use something like
myDateTime.ToShortDateString();
 
G

Guest

Thank you but the problem is the TextBox (TB) is filled by the DataSet (DS)
field (it's not a stand alone TB).

The DataGrid is fiilled by a fooDS. The TB (physically separate from DG but
on the same form) is filled by the DataIn column of the fooDS (i.e. fooDS -
TableName.DataIn). The fooDS properly displays the date in the DG but, the
TB contains the date (thats in the DG) and a base time.

How do I get rid of the base time from the TB?

What I what to do is something like: fooDS - TableName.DataIn (mm/dd/yyyy)
 

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

Similar Threads


Top