i need solution for System.FormatException: 'Input string was not in a correct format.'
i design desktop Application for Clinic
i want to get the result ( cost - paid)
i debug the app and compiler get error on
RemindTextBox.Text = Convert.ToString(Convert.ToDouble(PatientCostTextBox.Text) - Convert.ToDouble(PayedTextBox.Text));
What I have tried:
fuction to add new Patient
private void btn_Add_Click(object sender, EventArgs e)
{
if (radioButton_Male.Checked == true)
{
gender = "Male";
}
else
{
gender = "Female";
}
byte[] img;
MemoryStream ms1;
ms1 = new MemoryStream();
pictureBox1.Image.Save(ms1, pictureBox1.Image.RawFormat);
img = ms1.ToArray();
RemindTextBox.Text = Convert.ToString(Convert.ToDouble(PatientCostTextBox.Text) - Convert.ToDouble(PayedTextBox.Text));
Add_New_Patient.Add_Patient(
Convert.ToInt32(PatientIDTextBox.Text),
PatientTCTextBox.Text,
PatientNameTextBox.Text,
PatientAgeTextBox.Text,
gender,
PatientPhoneTextBox.Text,
comboBox_ShowState.SelectedIndex.ToString(),
dateTimeNOW.Value.Date.ToString(),
EmailTextBox.Text,
Convert.ToDouble(PatientCostTextBox.Text),
Convert.ToDouble(PayedTextBox.Text),
Convert.ToDouble(RemindTextBox.Text),
img,
NOTES_TextBox.Text
);
}
basic class
public static class Add_New_Patient
{
public static void Add_Patient( int Patient_ID,string Patient_Identity, string Patient_Name, string Age, string Gender, string Phone, string Patient_State, string Patient_Date,
string Patient_Email, double Cost, double Paid, double Remain, byte[] Patient_img, string NOTES
)
{
DXL.DXL ob = new DXL.DXL();
ob.open();
SqlParameter[] p = new SqlParameter[14];
p[0] = new SqlParameter("@Patient_ID", SqlDbType.Int);
p[0].Value = Patient_ID;
p[1] = new SqlParameter("@Patient_Identity", SqlDbType.NVarChar,50);
p[1].Value = Patient_Identity;
p[2] = new SqlParameter("@Patient_Name", SqlDbType.NVarChar, 50);
p[2].Value = Patient_Name;
p[3] = new SqlParameter("@Age", SqlDbType.NVarChar, 50);
p[3].Value = Age;
p[4] = new SqlParameter("@Gender", SqlDbType.NVarChar, 50);
p[4].Value = Gender;
p[5] = new SqlParameter("@Phone", SqlDbType.NVarChar, 50);
p[5].Value = Phone;
p[6] = new SqlParameter("@Patient_State", SqlDbType.NVarChar, 50);
p[6].Value = Patient_State;
p[7] = new SqlParameter("@Patient_Date", SqlDbType.Date);
p[7].Value =Patient_Date;
p[8] = new SqlParameter("@Patient_Email", SqlDbType.NVarChar, 50);
p[8].Value = Patient_Email;
p[9] = new SqlParameter("@Cost", SqlDbType.Float);
p[9].Value = Cost;
p[10] = new SqlParameter("@Paid", SqlDbType.Float);
p[10].Value = Paid;
p[11] = new SqlParameter("@Remain", SqlDbType.Float);
p[11].Value = Remain;
p[12] = new SqlParameter("@Patient_img", SqlDbType.Image);
p[12].Value = Patient_img;
p[13] = new SqlParameter("@NOTES", SqlDbType.NVarChar, 50);
p[13].Value = NOTES;
ob.RUA("New_Patient", p);
ob.close();
}