DatagridView and DateTime ...

  • Thread starter Thread starter £ukasz Margielewski
  • Start date Start date
£

£ukasz Margielewski

How to set DataGridView column property to display only time part of
System.DateTime value type?
For example - whem I have DateTimePicker, I can set format to custom HH:mm
and everything is allright...
Is any simple solution to do the same with DataGridView column property ??
 
DataGridView - hmm .. are you talking ADO.NET 2.0?

You can specify a format string in a new Binding you will need to add.
Or
You can use expressions/events to calculate a new column and bind that
instead. The new column will have to be of type string (I think).

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Thanks Sahil, nut I don't exactly know, how to do that? Could you give me a
short description ??
Yes - i'm using Net 2.0...
 
Okay try the rowchanging event on the DataTable you are binding with. In
that event, calculate the new expression value.
Then databind and make that particular column not visible, or databind with
an appropriate dataview instead.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
 
Thanks for advise, but I have already soled this problem .. I created
another column and used expression
like that :

SUBSTRING(Convert(COLUMN, System.String), x, y)
 

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

Back
Top