static public void ChangePlus() { try { js = LCD.CurrentCell.RowIndex; js += 2; tex.TextBox.Invoke((MethodInvoker)(() => tex.TextBox.Text = js.ToString())); string ks = tex.TextBox.Text; int row_ind = int.Parse(ks); int select = LCD.CurrentCell.RowIndex; row_ind--; LCD.Invoke((MethodInvoker)(() => LCD.CurrentCell = LCD.Rows[row_ind].Cells[1])); LCD.Rows[select].Selected = false; LCD.Rows[row_ind].Selected = true; string nm = LCD.Rows[row_ind].Cells[1].Value.ToString(); string fn = LCD.Rows[row_ind].Cells[2].Value.ToString(); string ln = LCD.Rows[row_ind].Cells[3].Value.ToString(); string N = LCD.Rows[row_ind].Cells[4].Value.ToString(); Name.Invoke((MethodInvoker)(() => Name.Text = nm)); FirstN.Invoke((MethodInvoker)(() => FirstN.Text = fn)); LastN.Invoke((MethodInvoker)(() => LastN.Text = ln)); number.Invoke((MethodInvoker)(() => number.Text = N)); } catch { MessageBox.Show("Впереди никого нет"); } }
static public void change_() { js = LCD.CurrentCell.RowIndex; tex.TextBox.Invoke((MethodInvoker)(() => tex.TextBox.Text = js.ToString())); string ks = tex.TextBox.Text; int row_ind = int.Parse(ks); int select = LCD.CurrentCell.RowIndex; row_ind--; if (row_ind == 0 || row_ind <= 0) { row_ind = 0; } LCD.Invoke((MethodInvoker)(() => LCD.CurrentCell = LCD.Rows[row_ind].Cells[1])); LCD.Rows[select].Selected = false; LCD.Rows[row_ind].Selected = true; string nm = LCD.Rows[row_ind].Cells[1].Value.ToString(); string fn = LCD.Rows[row_ind].Cells[2].Value.ToString(); string ln = LCD.Rows[row_ind].Cells[3].Value.ToString(); string N = LCD.Rows[row_ind].Cells[4].Value.ToString(); Name.Invoke((MethodInvoker)(() => Name.Text = nm)); FirstN.Invoke((MethodInvoker)(() => FirstN.Text = fn)); LastN.Invoke((MethodInvoker)(() => LastN.Text = ln)); number.Invoke((MethodInvoker)(() => number.Text = N)); }
private void Add_Click(object sender, EventArgs e) { // Add the new Person to the database this.personTableAdapter1.InsertPerson(FirstN.Text, LastN.Text, DToB.Value.Date.ToString()); this.Validate(); this.personAddressBindingSource.EndEdit(); this.tableAdapterManager.UpdateAll(this.myTownDBDataSet); UpdateData(); LastN.Clear(); FirstN.Clear(); }