private void Form5_Load(object sender, EventArgs e) { PersianCalendar pc = new PersianCalendar(); ss.Text = "1111/11/11"; sr.Text = "1111/11/11"; string m = pc.GetMonth(DateTime.Now).ToString(); if (m.Length < 2) { m = "0" + m; } string da = pc.GetDayOfMonth(DateTime.Now).ToString(); if (da.Length < 2) { da = "0" + da; } string date = pc.GetYear(DateTime.Now).ToString() + "/" + m + "/" + da; te.Text = date; er.Text = date; ch = true; Hokm hokm = new Hokm(); dt = hokm.getAllHokm(); DataTable dtCloned = dt.Clone(); dtCloned.Columns[0].DataType = typeof(string); dtCloned.Columns[1].DataType = typeof(string); dtCloned.Columns[2].DataType = typeof(string); dtCloned.Columns[3].DataType = typeof(string); dtCloned.Columns[4].DataType = typeof(string); dtCloned.Columns[5].DataType = typeof(string); dtCloned.Columns[6].DataType = typeof(string); dtCloned.Columns[7].DataType = typeof(string); dtCloned.Columns[8].DataType = typeof(string); dtCloned.Columns[9].DataType = typeof(string); foreach (DataRow row in dt.Rows) { dtCloned.ImportRow(row); } gridEX1.DataSource = dtCloned; }
private void Form5_Activated(object sender, EventArgs e) { Hokm hokm = new Hokm(); DataTable dt = hokm.getAllHokm(); DataTable dtCloned = dt.Clone(); dtCloned.Columns[0].DataType = typeof(string); dtCloned.Columns[1].DataType = typeof(string); dtCloned.Columns[2].DataType = typeof(string); dtCloned.Columns[3].DataType = typeof(string); dtCloned.Columns[4].DataType = typeof(string); dtCloned.Columns[5].DataType = typeof(string); dtCloned.Columns[6].DataType = typeof(string); dtCloned.Columns[7].DataType = typeof(string); dtCloned.Columns[8].DataType = typeof(string); dtCloned.Columns[9].DataType = typeof(string); foreach (DataRow row in dt.Rows) { dtCloned.ImportRow(row); } gridEX1.DataSource = dtCloned; }