Link to home
Start Free TrialLog in
Avatar of CASorter
CASorterFlag for United States of America

asked on

text file to series of listboxes

i have  text file that contains the previously saved contents of a group of listboxes.

here is a sample

ListBox4
ListBox3
06410 3x5 SAFETY                                        
06416 3x4 RED                                          
06418 3x4 BROWN                                        
06458 3x4 BLUEMIST                                      
ListBox2
06420 4x6 RED                                          
06421 4x6 BROWN                                        
06423 3x10 BROWN                                        
06425 3x4 SLATE                                        
06434 3x5 COFFEE                                        
06440 3x5 GREETING                                      
06443 3x4 NAVY                                          
06444 4x6 NAVY                                          
06445 3x10 NAVY                                        
ListBox1
06426 4x6 SLATE                                        
06428 3x10 SLATE                                        
06429 4x6 CHURCH&CHURCH  
MainListBox
01234 3x5 TURQUOISE                                    
06399 0x0 NOT-IN-SERVICE                                
06459 4x6 BLUEMIST                                      
06460 3x10 BLUEMIST                                    
06473 4x6 ROUNDBROWN                                    
06474 3x10 ROUNDBROWN                                  
06476 3x4 ROUNDBROWN                                    
06485 3x4 DESIGNERBLUE                                  
06486 4x6 DEIGNERBLUE                                  
06487 3x10 DESIGNERBLUE                                
06491 3x4 DESIGNERBROWN                                
06492 4x6 DESIGNERBROWN                                
06493 3x10 DESIGNERBROWN                                
08008 3x5 ESCBURGUNDY                                  
08028 3x10 ASHEVILLEPOLICE                              
08038 4x6 SHARPESLAWNLOGO                              
08040 4x6 H.T.HACKNEY                                  
08043 4x6 ABTECH                                        
08053 4x6 BB&T                    



what i want to do is read through the file and repopulate the appropriate listboxes with the text lines below each listbox

my question is .. .how do i get the string i read in to map to the corresponding list box on my form.

here is what i have so far

                FileOpen(fileNum, "c:\ini\" + txtSaveFile.Text.ToString, OpenMode.Input)
                Do Until EOF(fileNum)
                    fileString = LineInput(fileNum)
                    If fileString.StartsWith("List") Or fileString.StartsWith("main") Then
                        BoxString = fileString
                    Else
                        'point to listbox contained in  -BoxString
                        'add filestring to that listbox
                    End If
                Loop
ASKER CERTIFIED SOLUTION
Avatar of dustock
dustock
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CASorter

ASKER

now...  thats thinking "outside the box"

lol...

thanks

let you know if it works....


i would consider this an "old school" solution...  which is good.. i like that better...

but i never know when i should look for System.Reflection.Assembly.GetExecutingAssembly().Location to get the equivalant of the old app.path.....
thank you!
No problem, glad my old school style came in handy!