tify">} void b_add_Click (object sender, EventArgs e)
{. Visible=true; _replace.Visible=false; _delete.Visible=false; _exit.Visible=false; _add.Visible=false; _exit2.Visible=false; _save.Visible=false;.Text= raquo ;;. Text= raquo ;;. Text= raquo ;;. Text= raquo ;;. Text= raquo ;;
} void b_replace_Click (object sender, EventArgs e)
{. Text=customers DataGridView.CurrentRow.Cells [0] .Value.ToString () ;. Text=customers DataGridView.CurrentRow.Cells [1] .Value.ToString () ;. Text= customers DataGridView.CurrentRow.Cells [2] .Value.ToString () ;. Text=customers DataGridView.CurrentRow.Cells [3] .Value.ToString () ;. Text=customers DataGridView.CurrentRow.Cells [4] .Value. ToString () ;. ReadOnly=true; .Visible=true; _add.Visible=false; _delete.Visible=false; _exit.Visible=false; _exit2.Visible=false; _replace.Visible=false; _save.Visible=false;
} void b_cancel1_Click (object sender, EventArgs e)
{_ add.Visible=true; _delete.Visible=true; _exit.Visible=true; _exit2.Visible=true; _replace.Visible=true; _save.Visible=true; .Visible=false;
} void b_cancel2_Click (object sender, EventArgs e)
{_ add.Visible=true; _delete.Visible=true; _exit.Visible=true; _exit2.Visible=true; _replace.Visible=true; _save.Visible=true; .Visible=false;
} void b_save_Click (object sender, EventArgs e)
{_ Click_1 (sender, e);
} void b_record1_Click (object sender, EventArgs e)
{table=db_autoDataSet.Tables [1]; row=table.NewRow (); [0]=textBox1.Text; [1]=Convert.ToDateTime (textBox2.Text); [2] =textBox3.Text; [3]=textBox4.Text; [4]=textBox5.Text; .Rows.Add (row) ;. Hide (); _ replace.Visible=true; _delete.Visible=true; _exit.Visible= true; _add.Visible=true; _exit2.Visible=true; _save.Visible=true;
} void b_record2_Click (object sender, EventArgs e)
{vinRab; table=db_autoDataSet.Tables [1];//12 зв'язали динамич. табл. table з першим файлом з бази даних=Convert.ToInt64 (customersDataGridView.CurrentRow.Cells [4] .Value.ToString ());//13 отримали vin поточного запису
DataRow row=table.Rows.Find (vinRab);//14 поєднали динамич. рядок row зі записом файлу vin c shifrRab і перевели набір даних DataSet в стан редагування raquo ;, в якому він дозволяє змінювати значення полів [0]=textBox10.Text;//15 записали у друге поле рядка row дане з вікна [1] =Convert.ToDateTime (textBox9.Text);//15 записали в третє поле рядка row [2]=textBox8.Text;// 15 записали в четвертому полі рядка row row [3]=textBox7.Text;
row [4]=textBox6.Text; .AcceptChanges ();//15 команда AcceptChanges дозволяє прийняти змінені значення полів
groupBox2.Hide ();//16_replace.Visible=true; _delete.Visible=true; _exit.Visible=true; _add.Visible=true; _exit2.Visible=true; _save.Visible= true;
} void b_delete_Click (object sender, EventArgs e)
//видалення рядка під курсором
//спочатку будуємо попередження, щоб не зробити помилкового видалення
string s1, s2, s3, s4, s5, message; result;//18ind=customersDataGridView.CurrentRow.Index;=customersDataGridView.CurrentRow.Cells [0] .Value.ToString ();= customersDataGridView.CurrentRow.Cells [1] .Value.ToString ();=customersDataGridView.CurrentRow.Cells [2] .Value.ToString ();=customersDataGridView.CurrentRow.Cells [3] .Value.ToString ();=customersDataGridView. CurrentRow.Cells [4] .Value.ToString ();= Марка авто= + S1 + nДата візиту= + S2 + n Несправність= + S3 + n Тел. клієнта= + S4 + n vin номер + S5;
//змінна result може приймати значення або DialogResult.Yes, або DialogResult.No
//19=MessageBox.Show (message, Видалити наступний запис? ,. YesNo, MessageBoxIcon.Question); (result == DialogResult.Yes)//Рядок видаляється
{// 20 В буферну таблицю записується поточна таблиця з customersDataGridView типу DataGrid
CurrencyManager CurMng=(CurrencyManager) customersDataGridView.BindingContext [customersDataGridView.DataSource];
if (CurMng.Count gt; 0)//якщо таблиця не може пуста.RemoveAt (CurMng.Position);//видалення зазначеної позиції
}
//тут result == DialogResult.No і видалення відкидається
//виходимо з процедури
}
}
}