textBox6.Text did not show the correct answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

textBox6.Text did not show the correct answer

private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(textBox3.Text) && !string.IsNullOrEmpty(textBox4.Text) && !string.IsNullOrEmpty(textBox5.Text)) textBox6.Text = (Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text) * ((Convert.ToDouble(textBox3.Text) + Convert.To Double(textBox4.Text))/12) * Convert.ToDouble(textBox5.Text)).ToString(); }

30th Jun 2017, 5:32 PM
Theikdi Maung
Theikdi Maung - avatar
8 Answers
+ 4
thanks for your answer Mr.Volker Milbrandt and Mr.sneeze closing } is contain textBox6.Text do not show the correct answer
2nd Jul 2017, 6:54 AM
Theikdi Maung
Theikdi Maung - avatar
+ 2
Thank all finally i could thanks
12th Jul 2017, 5:56 PM
Theikdi Maung
Theikdi Maung - avatar
+ 2
textBox6.Text did not show the correct answer private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text) && !string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(textBox3.Text) && !string.IsNullOrEmpty(textBox4.Text) && !string.IsNullOrEmpty(textBox5.Text)) textBox6.Text = (Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text) * (Convert.ToDouble(textBox3.Text) + Convert.To Double(textBox4.Text)/12) * Convert.ToDouble(textBox5.Text)).ToString(); } //actually I convert squarefeet from feet and inches
13th Jul 2017, 5:26 AM
Theikdi Maung
Theikdi Maung - avatar
+ 1
how do you guarantee that all text boxes contain a valid double to convert and no other text? closing } is missing. are all text boxes accessible?
1st Jul 2017, 9:19 PM
Volker Milbrandt
Volker Milbrandt - avatar
+ 1
use variables make smaller steps use {} the are not mandatory but increase the readablity of your code. what do you want to do ?
1st Jul 2017, 9:22 PM
sneeze
sneeze - avatar
+ 1
can you give example data ? is the mathematical precedence correct ?
2nd Jul 2017, 8:48 AM
sneeze
sneeze - avatar
+ 1
I dint try but go on positive way to enter all data in correct format. ((convert.todouble(textbox1.text)* convert.todouble(textbox2.text)) * ((convert.todouble(textbox3.text)* convert.todouble (textbpx4.text)) / 12)* convert.todouble(textbox5.text)).tostring() kindly note don't go on syntax error. thanks ..
11th Jul 2017, 8:04 PM
Vijay Makwana
Vijay Makwana - avatar
+ 1
@Theikdi Maung: and what was now the solution?
13th Jul 2017, 4:39 AM
Volker Milbrandt
Volker Milbrandt - avatar