Gasgas Gas Gas

Gasgas Gas Gas

  • NA
  • 27
  • 971

check out this

Aug 1 2022 8:20 PM

am trying to make the variable years equal to the array year so that can use the years variable on the if statement so that i can easily compare the array values with the textbox input but am having and error on line number 5 

"  var  years = int[]year;"

this is csharp .Net

private void button1_Click(object sender, EventArgs e)
{
    string[] names = { "frank caprio", "thomas gigante", "anrnold popio" };
    string[] title = { "sons of frank", "the story", "in the end" };
    int[] year = { 2021, 2022, 2005, };
    int length= 2;
    for (int i = 0; i < length; i++)
    {
        var y = textBox1.Text;
        var  years = int[]year;
        if (y.Contains(years)) 
        { 
            lblsearchedbooks.Text = title[0];
        }
    }
}

 


Answers (1)