The follow error occurs with the following code: "Only assignment, call, increment, decrement, and new object expressions can be used as a statement"
{
((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
b = Math.Sqrt((c * c) - (a * a));
textBox2.Text = b.ToString();
}
Loading
Santhosh NPosted Jan 29, 2010, 1:46 AM
if (condition)
{
}
else if (condition2)
{
}
else
{
}
double a;
double b;
double c;
if ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox2.Text, out b)))
{
c = Math.Sqrt((a * a) + (b * b));
textBox3.Text = c.ToString();
}
else if ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
{
((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
b = Math.Sqrt((c * c) - (a * a));
textBox2.Text = b.ToString();
}
Mahesh ChandPosted Jan 28, 2010, 9:54 PM
{
{
{
double a;
double b;
double c;
if ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox2.Text, out b)))
{
c = Math.Sqrt((a * a) + (b * b));
textBox3.Text = c.ToString();
}
else
{
if ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
b = Math.Sqrt((c * c) - (a * a));
textBox2.Text = b.ToString();
}
}
}
}
}
}
Bobby WhitePosted Jan 28, 2010, 6:23 PM
Thanks in advance.
Bobby WhitePosted Jan 28, 2010, 2:10 PM
Bobby WhitePosted Jan 28, 2010, 2:04 PM
{
{
{
double a;
double b;
double c;
if ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox2.Text, out b)))
{
c = Math.Sqrt((a * a) + (b * b));
textBox3.Text = c.ToString();
}
else
{
((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
b = Math.Sqrt((c * c) - (a * a));
textBox2.Text = b.ToString();
}
}
}
}
}
}
Bobby WhitePosted Jan 28, 2010, 2:03 PM
Mahesh ChandPosted Jan 28, 2010, 1:53 PM
((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));
Something like this:
bool t = ((double.TryParse(textBox1.Text, out a)) && (double.TryParse(textBox3.Text, out c)));