We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How do I prefill a DataGrid cell with the current date/time

Thread ID:

Created:

Platform:

Replies:

3841 Apr 12,2003 04:25 PM Windows Forms 0
loading
Tags: FAQ
Steve Philcox
Asked On April 12, 2003 04:25 PM

I have seen code that suggests setting the Default property of the DataColumn in the corresponding DataTable to DateTime.Now. This solution uses the date/time at the moment of that call. How do I insert the "real" current date/time? Is it possible to run "code" to supply a value? I have the column set as readonly, and as part of the primary key. I have not been able to find another way to fill the field when a new row is to be added in the DataGrid. Is there an event that is triggered when a new row is to be added, and can I add a handler? Thanks.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;