vinod jangir

vinod jangir

  • NA
  • 114
  • 9.3k

how to cnvert string to int for date???

Sep 30 2015 5:00 AM
public int T_Date = 0;
private void addToolStripMenuItem_Click(object sender, System.EventArgs e)
{
try
{
DataColumn col = new DataColumn((dataGridView1.ColumnCount + 1).ToString());
//T_Date = System.DateTime.Now.ToString("dd.MM.yyyy");
//DateTime now = System.DateTime.Now;
T_Date = Convert.ToInt32(DateTime.Now);
dataGridView1.Columns.Add("Column", "T_Date");
if (dataGridView1.ColumnCount >0)
{
T_Date = 1;
}
else
{
T_Date = T_Date + 1;
}
dataGridView1.Columns[dataGridView1.RowCount - 1].CellType.IsValueType.GetType();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
 
 
 following error found
Invalid cast from 'DateTime' to 'Int32'.

Answers (4)