I've just started out with coding and I'm looking at making a simple Higher/Lower game. I have a random start number, and a new number set up when the 'higher' or 'lower' buttons are clicked. What I want to say though is....
If the person clicks the higher button: If NewNumberLbl
is greater than round1numberlbl. then do something. Thing is im getting the issue of not being able to say
If {NewNumberLbl.Text > Round1NumberLbl.Text}
{}
because I'm getting the error:
Error 1 Operator '>' cannot be applied to operands of type 'string' and 'string'
so how do I go about fixing this and making it into a type int?
Ps I was trying to create new int's , associate them with the ints within the random number methods and then call them instead?
HELP!
public Round1()
{
InitializeComponent();
RandomNumber(0, 12);
NewNumberLbl.Visible = true;
}
public void RandomNumber(int min, int max)
{
int num = new Random().Next(min, max);
Round1NumberLbl.Text = num.ToString();
}
public void RandomNumber2(int min, int max)
{
int num2 = new Random().Next(min, max);
NewNumberLbl.Text = num2.ToString();
}
private void Round1HBtn_Click(object sender, EventArgs e)
{
//RandomNumber2(0, 12);
//if (newNumber >= originalNumber)
//{
//}
}