I have created a Windows Application form in C# which has a datagridview control which name is datagridview1
and three text box which named txtTDate
, txtTaka
. i want to display the datagridview records to the text box when i select a row of datagridview. I successfully do that. But Problem is When i select a row in my datagridview textbox Tdate
shows the date as dd/mm/yyyy HH:MM:SS Like 25/06/2018 00:00:00
Format. I want to the text box only date like 25/06/2018. How can i do that. Please anyone help. N.B: My database TDate
field is DateTime
.
I use the folling code to retrieve data to text box txtTDate and txtTaka:
TDate.text = dataGridView1.SelectedRows[0].Cells[TDate].Value.ToString();
Taka.text = dataGridView1.SelectedRows[0].Cells[Taka].Value.ToString();