I get Input string was not in a correct format. error
-
I Get this error, when I write a number in my textBox1, and then erase it again.. Then this popup appers: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format. Code:
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
double tysk, ti, femten, tyve, dansk;
tysk = System::Convert::ToDouble(textBox1->Text);dansk = tysk \* 7.5; ti = tysk \* 7.5 \* 0.90; femten = tysk \* 7.5 \* 0.85; tyve = tysk \* 7.5\* 0.80; label7->Text = System::Convert::ToString(dansk); label8->Text = System::Convert::ToString(ti); label9->Text = System::Convert::ToString(femten); label10->Text = System::Convert::ToString(tyve); }
};
It also appers when I type a letter in the teksBox1. Otherwise it workd fine. Its just a simlpe calculator.
-
I Get this error, when I write a number in my textBox1, and then erase it again.. Then this popup appers: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format. Code:
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
double tysk, ti, femten, tyve, dansk;
tysk = System::Convert::ToDouble(textBox1->Text);dansk = tysk \* 7.5; ti = tysk \* 7.5 \* 0.90; femten = tysk \* 7.5 \* 0.85; tyve = tysk \* 7.5\* 0.80; label7->Text = System::Convert::ToString(dansk); label8->Text = System::Convert::ToString(ti); label9->Text = System::Convert::ToString(femten); label10->Text = System::Convert::ToString(tyve); }
};
It also appers when I type a letter in the teksBox1. Otherwise it workd fine. Its just a simlpe calculator.
-
I Get this error, when I write a number in my textBox1, and then erase it again.. Then this popup appers: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format. Code:
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
double tysk, ti, femten, tyve, dansk;
tysk = System::Convert::ToDouble(textBox1->Text);dansk = tysk \* 7.5; ti = tysk \* 7.5 \* 0.90; femten = tysk \* 7.5 \* 0.85; tyve = tysk \* 7.5\* 0.80; label7->Text = System::Convert::ToString(dansk); label8->Text = System::Convert::ToString(ti); label9->Text = System::Convert::ToString(femten); label10->Text = System::Convert::ToString(tyve); }
};
It also appers when I type a letter in the teksBox1. Otherwise it workd fine. Its just a simlpe calculator.
-
I Get this error, when I write a number in my textBox1, and then erase it again.. Then this popup appers: An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format. Code:
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
double tysk, ti, femten, tyve, dansk;
tysk = System::Convert::ToDouble(textBox1->Text);dansk = tysk \* 7.5; ti = tysk \* 7.5 \* 0.90; femten = tysk \* 7.5 \* 0.85; tyve = tysk \* 7.5\* 0.80; label7->Text = System::Convert::ToString(dansk); label8->Text = System::Convert::ToString(ti); label9->Text = System::Convert::ToString(femten); label10->Text = System::Convert::ToString(tyve); }
};
It also appers when I type a letter in the teksBox1. Otherwise it workd fine. Its just a simlpe calculator.
Use this instead of "Convert::ToString()" function int a = 287; String ^b = ""; b += a;