private void btnSearch_Click(object sender, EventArgs e) { SearchJob mySJob = null; string cnnstr = connectionString; string JobDescription = null; string customer = null; string customerTerms = null; string PONumber = ""; try { dgvShipments.Columns.Clear(); dgvItm.Columns.Clear(); mySJob = new SearchJob(cnnstr); mySJob.getJobData(this.txtJobNum.Text.Trim(), ref JobDescription, ref customer, ref customerTerms, ref PONumber, dgvShipments ); this.txtJobDes.Text = JobDescription; this.txtCustomer.Text = customer; this.txtCustomerTems.Text = customerTerms; this.txtCustomerPONum.Text = PONumber; mySJob.getitem(txtJobNum.Text, myRowIndex, dgvItm); dgvShipments.Rows[0].Selected = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { mySJob = null; } }
private void dgvShipments_CellClick(object sender, DataGridViewCellEventArgs e) { SearchJob mySJob = null; try { mySJob = new SearchJob(connectionString); myRowIndex = dgvShipments.Rows[e.RowIndex].Cells[0].Value.ToString(); mySJob.getitem(txtJobNum.Text, dgvShipments.Rows[e.RowIndex].Cells[0].Value.ToString(), dgvItm); mySJob.Dispose(); } catch { //MessageBox.Show(ex.ToString()); } finally { mySJob = null; } }