Dear everyone,I have an assignment due for my class and I basically finished it. I am stuck on one thing. I can't for whatever reason add a counter to the code. It keeps giving me an error saying that I can't convert int to string. Please explain where it needs to go and why you put it there. Here is my code:
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Linq;
System.Text;
System.Windows.Forms;
namespace
Lab6B
{
public partial class Form1 : Form
public Form1()
InitializeComponent();
}
int number;
private void Form1_Load(object sender, EventArgs e)
Random generator = new Random();
number = generator.Next(1, 101);
private void button1_Click(object sender, EventArgs e)
int guess = Convert.ToInt32(Guess.Text);
if (Guess.Text != string.Empty)
if (guess < number)
Evaluate.Visible =
false;
label2.Visible =
true;
label2.Text =
"Too Low!";
Clear.Visible =
BackColor =
Color.LightSeaGreen;
else if (guess > number)
"Too High!";
Color.SlateBlue;
else
MessageBox.Show("You are right! It took you {0} guesses.");
private void button2_Click(object sender, EventArgs e)
Guess.Text =
"";
Color.PowderBlue;
private void label2_Click(object sender, EventArgs e)
Thanks!