Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3046

[RESOLVED] I don't know how to write this conversion

$
0
0
I'm trying to get an integer from a textbox and then assign it to an integer variable. But it's not working. It even throws an exception. What's wrong with my code?

Here is what I got so far:

private void button1_Click(object sender, EventArgs e)
{
int firstNumber;
int secondNumber;
int quotient;

firstNumber = Convert.ToInt32(textBox1.Text);
secondNumber = Convert.ToInt32(textBox2.Text);
quotient = firstNumber * secondNumber;
textBox3.Text = Convert.ToString(quotient);

Viewing all articles
Browse latest Browse all 3046

Trending Articles