Home › Forums › WinForms controls › Xceed Grid for WinForms › dateTimePicker
-
AuthorPosts
-
#16082 |
Hi,
In order use datetimepicker in RichCellEditor functionality, I implemented the following code as explained by “CharlesB” in the earlier.
Dim dataRow As DataRow
dataRow = xgc_masterSplReq.DataRows.AddNew()
Dim dtpEditor As New DateTimePicker
dtpEditor.Format = DateTimePickerFormat.Custom
Dim dtpViewer As New DateTimePicker
dtpViewer.Format = DateTimePickerFormat.Custom
dtpEditor.CustomFormat =
“MM/dd/yy hh:mm:ss tt”
dtpViewer.CustomFormat =
“MM/dd/yy hh:mm:ss tt”
Dim dateEditor As New DateEditor()
Dim dateEditor1 As New CellEditorManager(dtpEditor, “Value”, True, True)
Dim dateViewer1 As New CellViewerManager(dtpEditor, “Value”)
dataRow.Cells(
“Value”).CellEditorManager = dateEditor1
dataRow.Cells(“Value”).CellViewerManager = dateViewer1
dataRow.Cells(“Value”).Value = DateTime.Now
dataRow.Cells(
“Item/Field”).Value = “Field1_DateTime”
dataRow.EndEdit()
On load the cell is displaying correct value (current date-datetime.now), but my problem is when I select another date it is displaying the selected date and if I put mouse (mouse hover) on that cell the value is reverting back to datetime.now (now selected date to currentdate -datetime.now) and at times on selection changed itself directly displaying the old date only ( what I gave by default i.e., datetime.now), I didn’t write any “mouse hover” event.
Please advise me on this.
Imported from legacy forums. Posted by pravi (had 792 views)
The problem here is that you are using the same instance of the control in both your viewer and your editor. You need to have an instance for each (like in the example I wrote).
It should be:
Dim dateViewer1 As New CellViewerManager(dtpViewer, “Value”)
Imported from legacy forums. Posted by CharlesB (had 542 views)
Hi,
Thanks for the response.
Can you please do a favour to me?
i.e., As per your instructions i created datetimepicker in rich cell editor functionality as below
Dim dataRow As DataRow
dataRow = GridControl1.DataRows.AddNew()
Dim dtpEditor As New DateTimePicker
dtpEditor.Format = DateTimePickerFormat.Custom
dtpEditor.ShowCheckBox =
True
Dim dtpViewer As New DateTimePicker
dtpViewer.Format = DateTimePickerFormat.Custom
dtpEditor.CustomFormat =
“MM/dd/yy hh:mm:ss tt”
dtpViewer.CustomFormat =
“MM/dd/yy hh:mm:ss tt”
Dim dateEditor As New DateEditor()
Dim dateEditor1 As New CellEditorManager(dtpEditor, “Value”, True, True)
Dim dateViewer1 As New CellViewerManager(dtpViewer, “Value”)
dataRow.Cells(
“Value”).CellEditorManager = dateEditor1
dataRow.Cells(
“Value”).CellViewerManager = dateViewer1
dataRow.Cells(
“Value”).Value = DateTime.Now
dataRow.Cells(
“Parameter”).Value = “datetimenow”
dataRow.EndEdit()
It is working fine, b
ut in the xceed’s DateEditor control functionality, xceed team implemented two more buttons(“Today” and “None”) and respective functionality in their DateEditor control.
Please advise me on this, Thanks in advance.
Imported from legacy forums. Posted by pravi (had 1419 views)
-
AuthorPosts
- You must be logged in to reply to this topic.