private void OpenInsertForm() { pnl_suspend_data_list_wlc_data.Controls.Clear(); form_insert f = new form_insert(this); f.TopLevel = false; pnl_suspend_data_list_wlc_data.Controls.Add(f); TextInsert(); f.Show(); }
public void InsertTop() { form_insert f = new form_insert(this); //int index = dataGridView_wlc_data.Rows[0].Index; int index = dataGridView_wlc_data.SelectedRows[0].Index; bool Itemfound = false; if (dataGridView_wlc_data.Rows.Count > 0) { foreach (DataGridViewRow NewItem in dataGridView_wlc_data.Rows) { if (Convert.ToString(NewItem.Cells[1].Value) == GetText.pid || Convert.ToString(NewItem.Cells[2].Value) == GetText.vin) { Itemfound = true; MessageBox.Show("PID or VIN Already Exists!!", "ADM WL/C"); break; } } } if (Itemfound == false) { DataRow dr = dt.NewRow(); string _1pid = (string)GetText.pid; string _pid = _1pid.Substring(2, 8); dr[0] = "F1" + _pid; dr[1] = GetText.vin; dr[2] = GetText.date; dr[3] = GetText.wlc; dr[4] = GetText.model; dr[5] = GetText.suffix; dr[6] = GetText.chassis; dr[7] = "Insert"; dt.Rows.InsertAt(dr, index); } }