Question: This C# program is a times table. The first number of the range goes in the first box, the last number of the range goes

This C# program is a times table. The first number of the range goes in the first box, the last number of the range goes in the second box, and the third box is the number I'm multiplying by. That part works, but I'm having a hard time with the loop for the blank boxes. It gives me the message "Type numbers in the text boxes" when I type a number in the first box. I think I'm supposed to type something after else...

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data; using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace TimesTable

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

int answer = 0;

int loopStart;

int loopEnd;

int multiplyBy = 10;

loopStart = int.Parse(textBox1.Text);

loopEnd = int.Parse(textBox2.Text);

multiplyBy = int.Parse(textBox3.Text);

listBox1.Items.Clear();

for (int i = loopStart; i < loopEnd; i++)

while (i <= loopEnd)

{

answer = multiplyBy * i;

listBox1.Items.Add(i + "times" + multiplyBy + "=" + answer.ToString());

i++;

}

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

int outputValue = 0;

bool isNumber = false;

isNumber = int.TryParse(textBox1.Text, out outputValue);

isNumber = int.TryParse(textBox2.Text, out outputValue);

isNumber = int.TryParse(textBox3.Text, out outputValue);

if (!isNumber)

{ MessageBox.Show("Type numbers in the text boxes");

}

else

{

}

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!