private void ButtonOnClick(object sender, EventArgs eventArgs) { var button = (Button)sender; if (button != null) { if (Convert.ToInt32(button.Name) == 144) //Если нажата кнопка "+" { this.Hide(); AddDoc adddoc = new AddDoc(); adddoc.Show(); } else //если нажаты кнопки дел { DataClass.DocID = Convert.ToInt32(button.Name); //Записываем номер документа к которому переходим this.Hide(); DocForm docForm = new DocForm(); docForm.Show(); } } }
private void button1_Click(object sender, EventArgs e) { if (Docs.SelectedItems.Count != 0) { //MessageBox.Show(Docs.SelectedItems[0].SubItems[0].ToString()); sql.command.CommandText = "SELECT id, caseID, departID FROM Document WHERE name LIKE '" + Docs.SelectedItems[0].SubItems[0].Text + "' "; SQLiteDataReader read5 = sql.command.ExecuteReader(); while (read5.Read()) { DataClass.DocID = Convert.ToInt32(read5["id"]); DataClass.CaseID = Convert.ToInt32(read5["caseID"]); DataClass.DepartID = Convert.ToInt32(read5["departID"]); } read5.Close(); DataClass.BackPage = "Search"; DocForm docForm = new DocForm(); docForm.Show(); this.Hide(); } }