Tom

Tom

  • NA
  • 56
  • 0

Comparing a string to a datatable

Sep 16 2008 8:57 AM
Hi there,
I am very new to C# (as my explanation will show)
I currently have a program that reads lines in from a text file, and processes them in a windows form.
The items being read are products, i want to calculate the occurrences of the read in products
Say for instance,
Apple
Apple
Orange
Banana

I want to be able to take "Apple" and then search through my frequency table, to see if it exists.  If it doesn't, add it, and change the occurrence to "1".  If it does, just change the occurrence on that record, then next item.
At the moment i am trying to construct a crazy while loop, but i think that there must be a easier way to simply compare my string to the datatables fields.

Thanks in advance for any help given :)
Tom


Answers (2)