<Vb6> Load a list Box with Lines From a File <Vb6>

Reply to topic Page 1 of 1 [ 4 posts ]
Author Message

Offline -McGuinn-

Gold Member


User avatar


Joined: Mon Nov 19, 2007 7:57 pm

Posts: 972

PostPosted: Sat Jul 26, 2008 9:46 pm   Post subject: <Vb6> Load a list Box with Lines From a File <Vb6>   

Sub LoadListFromFile(cListBox As ListBox, sCurrentFile As String)
    Dim sLineIn As String
    On Error GoTo ErrLoadListFromFile
   
    cListBox.Clear
    Open sCurrentFile For Input As #1
    While Not EOF(1)
        Line Input #1, sLineIn
        If Trim$(sLineIn) <> "" Then cListBox.AddItem sLineIn
    Wend
    Close #1
AfterLoadListFromFile:
Exit Sub

ErrLoadListFromFile:
    MsgBox "An Error occurred loading File:" + vbCrLf + _
      sCurrentFile, vbExclamation, "Unable to Continue"
    Resume AfterLoadListFromFile
End Sub


Work away

_________________
ImageImage
Top Profile E-mail 

Offline luke2895

Silver Member


User avatar


Joined: Fri Sep 21, 2007 6:10 pm

Posts: 147

PostPosted: Sat Oct 25, 2008 11:02 am   Post subject: Re: <Vb6> Load a list Box with Lines From a File <Vb6>   

i know this topic was posted ages ago but i need help. I'm doing it so when you press load accounts it will let you load your file, but its not working. Can you say what we need and what they need to be called for this to work, sorry to be a pain I'm just starting to learn vb6

_________________
Please visit my bebo - http://www.bebo.com/luke2895
Image
Image
Top Profile E-mail 

Offline Ally

Gold Member


User avatar


Joined: Tue Dec 18, 2007 7:17 pm

Posts: 427

Location: Livingston

PostPosted: Sat Oct 25, 2008 11:09 am   Post subject: Re: <Vb6> Load a list Box with Lines From a File <Vb6>   

luke2895 wrote:
i know this topic was posted ages ago but i need help. I'm doing it so when you press load accounts it will let you load your file, but its not working. Can you say what we need and what they need to be called for this to work, sorry to be a pain I'm just starting to learn vb6

You need a list view and name it "clistbox" without the quotes and in command1_click
call LoadListFromFile

_________________


Image



Purple Is Definitely A Fruit


Top Profile E-mail 

Offline Ben

Aciid VIP


Joined: Tue Apr 29, 2008 9:19 pm

Posts: 1342

Location: Cheltenham, Gloucestershire, United Kingdom

PostPosted: Sat Oct 25, 2008 11:11 am   Post subject: Re: <Vb6> Load a list Box with Lines From a File <Vb6>   

Ally wrote:
luke2895 wrote:
i know this topic was posted ages ago but i need help. I'm doing it so when you press load accounts it will let you load your file, but its not working. Can you say what we need and what they need to be called for this to work, sorry to be a pain I'm just starting to learn vb6

You need a list view and name it "clistbox" without the quotes and in command1_click
call LoadListFromFile


Yeah ally pretty much said it all.

Make a button, name it cmdLOAD or w/e, then double click CMDLoad and enter "call LoadListFromFile" (without quotes"")

Then make a new sub, and copy Fionns code into it 045

_________________
Used to Be Benyboyy Now Ben


My Bebo


Image
Top Profile E-mail 
Display posts from previous:  Sort by  
Reply to topic Page 1 of 1 [ 4 posts ]

 
 •  

Who is online
Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum