// submit data add to parent form private void btnAddSubmit_Click(object sender, EventArgs e) { BLLAdd control = new BLLAdd(); List <string> data = new List <string>(); data.Add(txtCompanyName.Text); data.Add(txtContactName.Text); data.Add(txtContactTitle.Text); data.Add(txtAddress.Text); data.Add(txtCity.Text); data.Add(txtRegion.Text); data.Add(txtRegion.Text); data.Add(txtCountry.Text); data.Add(txtPhone.Text); data.Add(txtFax.Text); data.Add(txtHomePage.Text); if (data[0] == "") { MessageBox.Show("CompanyName not Null"); } else if (control.Add(data) == 1) { MessageBox.Show("Thêm thành công !"); this.Close(); } else { MessageBox.Show("Thêm thất bại"); } }
// load data into grid view public void LoadDataGridView() { BLLAdd control = new BLLAdd(); DataTable dt = new DataTable(); dt = control.getDataTable(); gridView.DataSource = dt; }