private void loadBilling_button_Click(object sender, EventArgs e) { CustomerDB custDB = new CustomerDB(); BillingDB billDB = new BillingDB(); DataTable dta = new DataTable(); if (!string.IsNullOrWhiteSpace(billingId_textBox.Text)) { int billId = Convert.ToInt32(billingId_textBox.Text); dataLoaded = true; dta = billDB.showBilling(billId); string paid = null; foreach (DataRow row in dta.Rows) { custBilling_textBox.Text = row["customerId"].ToString(); monthBilling_comboBox.SelectedItem = row["billingMonth"].ToString(); yearBilling_comboBox.SelectedItem = row["billingYear"].ToString(); mailDate_picker.Value = Convert.ToDateTime(row["mailDate"].ToString()); meterNumber_textBox.Text = row["meterNumber"].ToString(); meterReading_textBox.Text = row["meterReading"].ToString(); amtToPay_textBox.Text = row["amountToPay"].ToString(); paid = row["paid"].ToString(); if (paid == "yes") { paidYes_radioButton.Checked = true; paidDate_picker.Value = Convert.ToDateTime(row["paidDate"].ToString()); } else { paidNo_radioButton.Checked = true; paidDate_picker.Value = DateTime.Today; } } } else { MessageBox.Show("Invalid Billing ID"); editBillingPage_ClearUp(); } }