c# - Searching for a String in a text file -


hello i'm trying search word "jeep" located in text file. have constructor class , set items. use loop cycle through cars , if statement word "jeep". if there take mileage of jeeps , pop in message box. not think word search working. thank you!

private void btnjeep_click(object sender, eventargs e) {     double jeepmile = 0;     (int = 0; > cars.count; i++)     {         if (cars[i].make == "jeep")         {             jeepmile = cars[i].mileage;         }     }     messagebox.show("the average mileage of jeeps is: " + jeepmile, "jeep mile avg.", messageboxbuttons.ok); } 

change: (int = 0; > cars.count; i++) to: (int = 0; < cars.count; i++)


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -