- #1
adjacent
Gold Member
- 1,552
- 63
This is my code:
When I write a large value like 1000000 in the To.Textbox, the software freezes. I don't know why. If the computer is strong enough, it should be able to calculate it right?
Code:
double of = 0;
double from = 0;
double to = 0;
double ans = 0;
private void button1_Click(object sender, EventArgs e)
{
Table.Items.Clear();
if (double.TryParse(Of.Text, out of) == true && double.TryParse(From.Text, out from) == true && double.TryParse(To.Text, out to) == true)
{
of = double.Parse(Of.Text);
from = double.Parse(From.Text);
to = double.Parse(To.Text);
for (double i = from; i <= to; i++)
{
ans = i * of;
Table.Items.Add(of + " x " + i + " = " + ans.ToString());
}
}
else
{
MessageBox.Show("Please enter a valid value");
}
}