VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code populates a listbox from a .CSV

by Mike Marshall (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 21st December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code populates a listbox from a .CSV

Rate This code populates a listbox from a .CSV




Dim loconnection As New ADODB.Connection
Dim lorecordset As New ADODB.Recordset

loconnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=C:\;" & _
          "Extended Properties=""TEXT;DriverId=27;FIL=text;MaxBufferSize=2048;PageTimeout=5;"""
  
            lorecordset.Open "select * from xxx.csv", _
            loconnection, adOpenStatic, adLockReadOnly, adCmdText
          
          
            Do While Not lorecordset.EOF
            List1.AddItem lorecordset.Fields(1).Value
            List2.AddItem lorecordset.Fields(2).Value
            lorecordset.MoveNext
            Loop
            loconnection.Close
          
          
          
End Sub

Download this snippet    Add to My Saved Code

This code populates a listbox from a .CSV Comments

No comments have been posted about This code populates a listbox from a .CSV. Why not be the first to post a comment about This code populates a listbox from a .CSV.

Post your comment

Subject:
Message:
0/1000 characters