Hey everyone,
I am in the midst of creating a very basic auction site using C#. Only been learning the language for 3 months so still very much getting used to it and finding out new things everyday.
I am using a local database to store my data and want to include a search option on the windows form that will allow a user to search for a model of laptop. Example - The user can type Sony and the Sony laptop I have stored will show.
I was wondering if someone could explain this code to me:
private void LaptopsForm_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'laptopsDataSet.Laptop_Information' table. You can move, or remove it, as needed.
this.laptop_InformationTableAdapter.Fill(this.laptopsDataSet.Laptop_Information);
List<string> manufactures = new List<string>();
for (int i = 0; i < laptopsDataSet.Laptop_Information.Count; i++)
{
manufactures.Add(laptopsDataSet.Laptop_Information.ElementAt(i).Manufacturer);
}
int index = 0;
foreach (string s in manufactures)
{
if (s.Equals("Sony"))
{
label1.Text = laptopsDataSet.Laptop_Information.ElementAt(index).Model;
break;
}
else
index++;
}
Thanks guys!