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

Mahesh ChandRank #1 · 393.3K reputationPosted Jan 28, 2010, 8:53 AM EST
((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)));
Bobby White15 reputationPosted Jan 28, 2010, 9:03 AM EST
Bobby White15 reputationPosted Jan 28, 2010, 9:04 AM EST
{
{
{
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 White15 reputationPosted Jan 28, 2010, 9:10 AM EST
Bobby White15 reputationPosted Jan 28, 2010, 1:23 PM EST
Thanks in advance.
Mahesh ChandRank #1 · 393.3K reputationPosted Jan 28, 2010, 4:54 PM EST
{
{
{
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();
}
}
}
}
}
}
Santhosh NRank #4,788 · 325 reputationPosted Jan 28, 2010, 8:46 PM EST
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();
}