Home - Forums-.NET - FlyGrid.Net (Windows Forms) - How to add datetimepicker control to cell...

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

How to add datetimepicker control to cell...
Link Posted: 10-Aug-2005 03:40
I have a flygrid with two columns 1) attribute 2) value what I want to be able to do is at runtime add a row that has the word "date" in column1 and a datetimepicker control in column2 (column 2 however will not always contain datetime, could be text, dropdown etc.)

1) How would I do this in vb.net?
2) How can I add a value to that cell i.e. 12/08/2005?
3) Is it possible to have the cell in this format 12/08/2005 rather than 12/08/2005 15:35:01 ?

Also in this version of flygrid are you able to have nothing in this datetime cell, if I remember the earlier version would always put something like -00/00/0000 00:00:00?

I have looked at your vertical grid example but still could not figure it out.

I know this is quite a few questions in one.

Thanks for your time

Simon
Link Posted: 11-Aug-2005 05:38
[quote="lidds"]I have a flygrid with two columns 1) attribute 2) value what I want to be able to do is at runtime add a row that has the word "date" in column1 and a datetimepicker control in column2 (column 2 however will not always contain datetime, could be text, dropdown etc.)

1) How would I do this in vb.net?


See the Grid Stylizing VB.Net sample - you can use for these purposes DateTimeColumn. This type of column supports datetimepicker as dropdown. Also you can set FormatString property to format date/time values for displaying.

[quote="lidds"]
2) How can I add a value to that cell i.e. 12/08/2005?



C#:
datetimeColumn.SetValue(someNode, new DateTime(2005, 08, 12));

or

flyGrid.Rows.Items.Add(new Node(new object[]{"Current Date", new DateTime(2005, 08, 12)}));

or

NodeBase node = flyGrid.Rows.Items[10];
object[] value = node.Value as object[];
value[1] = DateTime(2005, 08, 12);


[quote="lidds"]
3) Is it possible to have the cell in this format 12/08/2005 rather than 12/08/2005 15:35:01 ?


See the Column.FormatString:
to display 12/08/2005 set FormatString = "M/d/yyyy"

[quote="lidds"]
Also in this version of flygrid are you able to have nothing in this datetime cell, if I remember the earlier version would always put something like -00/00/0000 00:00:00?
I have looked at your vertical grid example but still could not figure it out.

Set the value of cell to null to display nothing than -00/00/0000 00:00:00