c# - How to display the value of date in the date and time picker box on the datagrid view when double clicked -
i got code here. of textboxes working except datetime picker box. want display records textboxes , datetime picker box when record double clicked. please help.
datatable dt = new datatable(); sqldataadapter da = new sqldataadapter("select * employee2 [employee id] = " + (dgdata.selectedrows[0].cells[0].value.tostring()) + " ", con); da.fill(dt); textbox1.text = dt.rows[0][0].tostring(); textbox2.text = dt.rows[0][1].tostring(); dtpicker.value.tostring("dd-mmm-yyyy") = dt.rows[0][2]; textbox4.text = dt.rows[0][3].tostring(); textbox5.text = dt.rows[0][4].tostring(); displayrecords();
i assume 3rd column(date column) of datetime
type in table.
problem : not assigning value
datetimepicker
control.
try this:
dtpicker.value = convert.todatetime(dt.rows[0][2]); /*set custom format now*/ datetimepicker1.customformat = "dd-mmm-yyyy"; datetimepicker1.format =datetimepickerformat.custom;
Comments
Post a Comment