visual studio 2008 - How do I manipulate the format on a DataGridView that is bound to a Data Source? -
I am using SQL Server 2005 and Visual Studio 2008, C #.
In the data source (SQL Server Data Table) I use the DateTime format mm / day / yyy / , however In the form overview (Data Grid view), users want to see a completely different format, year, week number, and number of weeks ( yyww, d ) which string In the format I make an algorithm for the change between prices (date to day) Or, but can I populate the affected cells with yyww, d (string) instead of mm / dd / yyy (date time)?
This is what I am trying to successfully (and note), this problem becomes apparent on the last line, because cell value does not accept string at runtime - it does not Still wanting a DateTime ...)
Private Zero DatagridViewingFindwareSelfarming (Object Sender, Data Grid Visualization Event Event E) {string weekAndDay = ""; DataGrade View Cell = DataGrid WidgetWindowWise Rao [E. Randex]. Seles [E. Column index]; If (cell column index == 13 & cell value == zero) mEmptyRow = true; If ((cell.ColumnIndex ==14 || cell.ColumnIndex ==15) & amp; amp; amp; amp ;; M.P.T.RO) {weeks and days = classes and datesDetate numbers (convert toDateTime (cell.Value)); Cell.ValueType = typeof (string); Cell.Value = Week and; }}
A few days ago I had a similar problem. Try not to change cell formatting
in
ValueType
, but only value
.
format exposure
then runtime, you want to store it back when the value will be changed / parsed
You can call it cellpersing
events and you can mm / dd / yyyy
Perhaps this answer can help:
Comments
Post a Comment