|
-
Nov 16th, 2005, 12:49 AM
#1
Thread Starter
Lively Member
StreamReader to List
OK, here's my problem. I have a text file which is tab delimited. So it looks like this:
VB Code:
21 entryA
22 entryB
23 entryC
Anyway, it has a lot of things in it. Instead of putting all items into a listbox collection and then making a casewhere structure in the list's SelectedIndexChanged event to compare the right number to each list entry (To store in a variable), I was thinking that I would use StreamReader to read from the text file and somehow store the numbers seperately from the entries. Using casewhere means that it would be an enourmous ammount of coding (Over 200 entires).
This allows me to:
a) Read the file.
b) Put the entries into the list without their corresponding numbers.
c) When I then click on an entry, it compares it to it's corresponding number.
d) That number is stored in a variable and the user never sees it.
The point is to avoid using a long casewhere structure with over 200 cases. Another advantage is that what if I want to change entires in the list? So much easier. Also, another snag is that the entries in the list ARE NOT arranged according to their number, but arranged alphabetically. So this explains why I can't just get the index number of the entry from the list. I'm also not really experienced in the area of using arrays or records, but I have I feeling I'll be using them to solve this. I do know how to use streamreader though, and 1D arrays.
I have a feeling I haven't explained something well enough or just enough. Thanks in advance.
Last edited by martw; Nov 16th, 2005 at 01:30 AM.
I never know what to put in this section...

So sue me... ... ... I'm just kidding...
www.fat-pie.com Flash Movies... You gotta see 'em to believe 'em!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|