Need to store GridViewDateTimeValue into DateTimePicker

Posted by narmadha on Stack Overflow See other posts from Stack Overflow or by narmadha
Published on 2010-04-01T10:08:46Z Indexed on 2010/04/01 10:13 UTC
Read the original article Hit count: 315

Filed under:

Hi,I am Using Gridview in WindowsApplication.The following is my code:

                      if (dgvList.SelectedRows.Count > 0)
            {
                if (dgvList.SelectedRows[0].Cells != null)
                {
                    DataGridViewRow dr = dgvList.CurrentRow;
                    txtMaterialName.Text = dr.Cells["MaterialName"].ToString();



        dateTimePicker1.Text=DateTime.Parse(dr.Cells["PurchasedDate"].ToString()).ToString();
             }
           }

i need to store the PurchasedDate into DateTimePicker,But the Error is "The string was not recognized as a valid DateTime. There is a unknown word starting at index 0." Source="mscorlib" StackTrace: at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) at System.DateTime.Parse(String s) at Godwins.EditStockAvailabilty.dgvList_SelectionChanged(Object sender, EventArgs e)

Can anyone help me,Thanks in advance.........

© Stack Overflow or respective owner

Related posts about c#2.0