Click here to Skip to main content
15,889,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to set datagridview cell value to datetimepicker in windows forms.
The value of the cell that I am getting is in the format "MM/dd/yyyy hh:mm:ss".
I want to change it to the format "dd/MM/yyyy hh:mm:ss".

This is my code:
C#
dateTimePicker1.Value = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString())
Posted

1 solution

Only you change your datetimepicker control property

1. Formate - Custom
2 Customformate - dd/MM/yyyy hh:mm:ss

not change your code.

Thanks & Regard
Sham :)
 
Share this answer
 
Comments
Priyanka7777 22-Aug-13 7:28am    
I did in the design but still i am not able to change it.
Shambhoo kumar 22-Aug-13 7:34am    
But It's working for me dear frnd. I thing you forget to change datetimepicker format property to Custom.
Thanks7872 22-Aug-13 7:36am    
It works fine. I tested it.
Shambhoo kumar 22-Aug-13 7:40am    
Ok.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900