//открываем окно добавления записи private void AddGridViewMenuItem_Click(object sender, EventArgs e) { if (!Data.IsConnect) return; InfoWindow = new InfoForm(false, Data); InfoWindow.GeneralWindow = this; InfoWindow.Show(); InfoWindow.Location = new Point(Location.X + 20, Location.Y + 70); }
public GeneralForm() { InitializeComponent(); Data = new DataClass(this); InfoWindow = null; }
private void InfoToolStripMenuItem_Click(object sender, EventArgs e) { //проверка был ли конект к базе раннее if (!Data.IsConnect) return; if (DataGridView[0, DataGridView.CurrentRow.Index].Value == DBNull.Value) return; String Fam = Convert.ToString(DataGridView[1, DataGridView.CurrentRow.Index].Value); String Im = Convert.ToString(DataGridView[2, DataGridView.CurrentRow.Index].Value); String Otch = Convert.ToString(DataGridView[3, DataGridView.CurrentRow.Index].Value); DateTime Date = Convert.ToDateTime(DataGridView[4, DataGridView.CurrentRow.Index].Value); String Adres = Convert.ToString(DataGridView[5, DataGridView.CurrentRow.Index].Value); InfoWindow = new InfoForm(true, Data); InfoWindow.SetInfoForm(Fam, Im, Otch, Date, Adres); InfoWindow.Show(); InfoWindow.Location = new Point(Location.X + 20, Location.Y + 70); }