private void button3_Click(object sender, EventArgs e) { // create an instance of frmBox frmAddCustomer myCustomerForm = new frmAddCustomer(); //display the form myCustomerForm.Show(); }
private void btnAdd_Click(object sender, EventArgs e) { //create an instance of frmAddCustomer(); frmAddCustomer Customers = new frmAddCustomer(); //display the add game form Customers.Show(); //invoke the addNewGame method (that I have created in frmAddCustomer) Customers.AddNewCustomer(); }
private void btnEdit_Click(object sender, EventArgs e) { //create an instance of frmAddGame frmAddCustomer Customers = new frmAddCustomer(); //declare a variable to store the game no from the list box int CustomerNo; //check to see if a record has been selected if (lstCustomer.SelectedIndex != -1) { //get the selected value from the list which should contain the primary key CustomerNo = Convert.ToInt32(lstCustomer.SelectedValue); Customers.Show(); //invoke the findGameNo method (I created in frmAddGame) Customers.FindCustomer(CustomerNo); } else { MessageBox.Show("Please select a customer from the list", "Customer List", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }