private void btnAdd_Click(object sender, EventArgs e) { //Get the value from the input fields c.FirstName = txtboxFirstName.Text; c.LastName = txtboxLastName.Text; c.ContactNo = txtBoxContactNumber.Text; c.Address = txtBoxAddress.Text; c.Gender = cmbGender.Text; //Inserting Data into DAtabase uing the method we created in previous episode bool success = c.Insert(c); if (success == true) { //Successfully Inserted MessageBox.Show("New Contact Successfully Inserted"); //Call the Clear Method Here Clear(); } else { //FAiled to Add Contact MessageBox.Show("Failed to add New Contact. Try Again."); } //Load Data on Data GRidview DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void button2_Click(object sender, EventArgs e) { //get data from textboxes c.ContactID = int.Parse(txtboxContactID.Text); c.FirstName = txtboxFirstName.Text; c.LastName = txtboxLastName.Text; c.ContactNo = txtBoxContactNumber.Text; c.Address = txtAddress.Text; c.Gender = cmbGender.Text; //update data in data base bool success = c.Update(c); if (success == true) { //update Successfully MessageBox.Show("Contact has been successfully updated."); //load data on data griedview DataTable dt = c.Select(); dgvContactList.DataSource = dt; //call clear method Clear(); } else { //Failed to update MessageBox.Show("Failed to Update Contact."); } }
private void btnAdd_Click(object sender, EventArgs e) { //Get the value from the input fields c.FirstName = txtboxFirstName.Text; c.LastName = txtboxLastName.Text; c.ContactNo = txtboxContactNo.Text; c.Address = txtboxAddress.Text; c.Gender = cmbGender.Text; //Insert data into database using method created bool success = c.Insert(c); if (success) { MessageBox.Show("Contact Interted successfully"); //Call method Clear(); } else { MessageBox.Show("Failed to add New Contact"); } //Display data on data grid DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
contactClass c = new contactClass(); //importu form ile yaptım hata verebilir private void Econtact_Load(object sender, EventArgs e) { //Load data on data grid view DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void Econtact_Load(object sender, EventArgs e) { //Carregar dados em DataGridView DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void btnAdd_Click(object sender, EventArgs e) { //Get the value from the input field c.FirstName = txtBoxFirstName.Text; c.LastName = txtBoxLastName.Text; c.ContactNo = txtBoxContactNumber.Text; c.Address = txtBoxAddress.Text; c.Gender = cmdGender.Text; //insert data into database using our method bool success = c.Insert(c); if (success == true) { MessageBox.Show("New Contact Successfully Inserted !"); //call cleaer method Clear(); } else { MessageBox.Show("Try Again"); } //load data to data grid view DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void Button_Click(object sender, RoutedEventArgs e) { //Get the value from the input fields c.FirstName = txtboxFirstName.Text; c.LastName = txtboxLastName.Text; c.ContactNo = txtboxContactNumber.Text; c.Address = txtboxAddress.Text; c.Gender = cmbGender.Text; //Inserting Data into Database bool success = c.Insert(c); if (success == true) { MessageBox.Show("New Contact Successfully Inserted"); Clear(); } else { MessageBox.Show("failed to Add New Contact. Try again!"); } DataTable dt = c.Select(); dataGrid.ItemsSource = dt.DefaultView; }
private void btnAdd_Click(object sender, EventArgs e) { //Get the values from input fields c.firstName = txtFirstName.Text; c.lastName = txtLastName.Text; c.email = txtEmail.Text; c.contactNo = txtCntNo.Text; c.address = txtAddress.Text; c.gender = comboGender.Text; //Inserting data into database bool isSuccess = c.Insert(c); if (isSuccess == true) { MessageBox.Show("New Contact Successfully Inserted "); clear(); } else { MessageBox.Show("Faild to Added new Contact try again"); } //load data table DataTable dt = c.Select(); dgvContact.DataSource = dt; }
private void btnAdd_Click(object sender, EventArgs e) { // Get the value from the input fields c.FirstName = txtboxFirstName.Text; c.LastName = txtboxLastName.Text; c.ContactNo = textBoxContactNumber.Text; c.Address = textBoxAddress.Text; c.Gender = cmbGender.Text; //Insert Data into Database using the method created bool success = c.Insert(c); if (success == true) { MessageBox.Show("New Contact Successfully Inserted"); //Call the clear method to clear the field Clear(); } else { MessageBox.Show("Failed to add new Contact"); } // Load Data on Data Grid View DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void BtnAdd_Click(object sender, EventArgs e) { c.FirstName = textBoxFirstName.Text; c.LastName = textBoxLastName.Text; c.ContactNo = textBoxContactNo.Text; c.Address = textBoxAddress.Text; c.Gender = cmbGender.Text; bool success = c.Insert(c); if (success == true) { MessageBox.Show("New contact successfully Inserted"); clear(); } else { MessageBox.Show("Faild to add new contact"); } DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void btn_add_Click(object sender, EventArgs e) { c.FirstName = txtFirstName.Text; c.LastName = txtLastName.Text; c.ContactNumber = txtContactNumber.Text; c.Address = txtAddress.Text; c.Gender = cmbGender.Text; bool success = c.Insert(c); if (success == true) { MessageBox.Show("New contact successfully inserted."); Clear(); } else { MessageBox.Show("Failed to insert new contact."); } DataTable dt = c.Select(); dgvContactList.DataSource = dt; }
private void add_Click(object sender, EventArgs e) { c.id = id.Text; c.name = name.Text; c.email = email.Text; c.gender = gender.Text; c.address = address.Text; c.phone = phone.Text; bool sucess = c.insert(c); if (sucess = true) { MessageBox.Show("insert sucess...!"); } else { MessageBox.Show("faild to insert...!"); } DataTable dt = c.Select(); dgvContactList.DataSource = dt; }