open a text file, sort the contents, and then save it to another text file.

boy141
04-06-2004, 04:28 PM
hey ya'll,
I need help on figuring out how to let me open dialog box sort my text file that has a bunch of numbers in them. I HAVE to use stream reader/writer. When I read the file, it can't comprehend the spaces like so:

10
4
2
56
-1

it dies cause it is trying to read the string. Please help me on this one.


szSrcFile = Reader.ReadToEnd()
While Not IsNothing(szSrcFile)
szContents.Add(intCatcher.Parse(szSrcFile))
szSrcFile = Reader.ReadToEnd()
End While
''''''''''''''''''''''''''''
For nIndex = 0 To szContents.Count - 1
'
lbUnsorted.Items.Add(szContents(nIndex).ToString())
''
Next nIndex

boy141
04-06-2004, 04:34 PM
here is more info to the thing:


Design a user interface for the sort application that you submitted for G2-2. You
are gradually going to be adding functionality to your sort application and this
assignment deals strictly with the interface.

The interface should have the following features:

1. Dialog box asking you to enter a username and password to enter or login to the
application.
2. Pull-down menus (use these for anything that makes sense).
3. Dialog / explorer box that shows you your hard disk directory structure so that
you can choose the file that you want to use as the input data to the sort program.
4. Save as… icon or pulldown that opens a dialog like that in #3 above to save the
sorted data to a file.
5. Add four (4) more unique interface items. These can do whatever you want them
to; think about the interfaces we viewed yesterday for ideas.
6. This interface must have the “look-and-feel” of that provided by MFC. For an
example of what this is, just look at any Microsoft software product, e.g., Word,
Powerpoint, Outlook, etc.

If you have any questions, feel free to email me. Ideally, you will formulate your
assumptions and answers to these questions by thinking about how other applications
implement user interfaces.

Email your answers or submit them via the Digital Drop Box (send me an email when it
is uploaded on DD).

Machaira
04-07-2004, 06:43 AM
First - we're not going to do your homework assignments for you.
Second - AFAIK, the Parse function doesn't handle multiple items
Third - instead of reading the whole file at once, try reading each line, adding it to the ArrayList as a numeric data type. Then use the Sort function of the class to sort it.

boy141
04-10-2004, 08:54 PM
Thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum