reading a file

  • Thread starter Thread starter microsoft.news.com
  • Start date Start date
M

microsoft.news.com

I'm reading a text file data and creating a new one with only certain data.
In the new file I need to format like so

Delaware Dover
Wilmington
New Castle

New York New York City
Fishkill
Watertown


how can i format my new file such as this?

the old file looks like this
State City
Delaware Dover
Delaware Wilimington
Delaware New Castle
New York New York City
New York Fishkill
New York Watertown
 
I'm reading a text file data and creating a new one with only certain data.
In the new file I need to format like so

Delaware Dover
Wilmington
New Castle

New York New York City
Fishkill
Watertown


how can i format my new file such as this?

the old file looks like this
State City
Delaware Dover
Delaware Wilimington
Delaware New Castle
New York New York City
New York Fishkill
New York Watertown

Well, how far have you got so far? Do you have a detailed question?
 
How can i format my new file like this?
I can get the data and see it, but I can have it appear like below?
I never done this before so i'm stuck. I can read the current file, get the
data out, but I need to group the states as below
 
How can i format my new file like this?
I can get the data and see it, but I can have it appear like below?
I never done this before so i'm stuck. I can read the current file, get the
data out, but I need to group the states as below

Well, you could use a Hashtable, and populate it with a ArrayLists -
one per state, with each list containing cities. The key of the
Hashtable would be the state, so you could quickly find the list of
cities and add to it. Or you could create your own State class
containing a list of cities.
 
I don't know how to do that. Where can i find something like that online? I
never used a hashtable or done anything like this before.
 
I don't know how to do that. Where can i find something like that online? I
never used a hashtable or done anything like this before.

I suggest you read a tutorial on C# and .NET in general - learning it
piecemeal isn't a particularly good idea. I don't have any particular
recommendations in terms of books and tutorials, but there are plenty
around.
 
Back
Top