private void BtnSearchDocNo_Click(object sender, EventArgs e) { // Formatting the form: LblTotalTrans.Visible = true; LblTotalTravel.Visible = true; TxtTotalTrans.Visible = true; TxtTotalTravel.Visible = true; LblPound1.Visible = true; LblPound2.Visible = true; try { using (DBAuditDataContext dc = new DBAuditDataContext()) { // Search progress: var c = dc.ProGetTransFeeByDocNo(TxtDocNo.Text); GrdViewTransFees.DataSource = c; // Calculating: double?DoubleTotalTrans = null; double?DoubleTotalTravel = null; int? IntCount = null; var d = dc.ProCountTotal(TxtDocNo.Text, ref DoubleTotalTrans, ref DoubleTotalTravel, ref IntCount); TxtCountRec.Text = IntCount.ToString(); TxtTotalTrans.Text = DoubleTotalTrans.ToString(); TxtTotalTravel.Text = DoubleTotalTravel.ToString(); } } catch (Exception EX) { MessageBox.Show(EX.Message); } }