👨‍🏫 Tutorial Load text file text to list using VB6

Status
Not open for further replies.

CodeWarrior

Grasshopper
This tutorial demonstrate how to load your text file inner text to list

First open notepad and type the following data

Item Loading 1
Item Loading 2
Item Loading 3
Item Loading 4
Item Loading 5
Item Loading 6
Item Loading 7

an save it, save any file name you wan't

Second Open your VB6 and create new project

Add List to the form then copy paste this code

Code:
Option Explicit

Private Sub Form_Load()
   Dim CW As Long
   Dim line As String
   CW = FreeFile
   Open App.Path & "\MyTextFile.txt" For Input As #CW
   Do While Not EOF(CW)
       Line Input #CW, line
       If Len(line) Then List1.AddItem line
   Loop
   Close #CW
End Sub

After that copy or move your create text file and paste inside this project folder.
Now Press F5 to start debuging...

Happy Happy Coding....

This code is credited to ME... :)
 
Status
Not open for further replies.

About this Thread

  • 1
    Replies
  • 1K
    Views
  • 2
    Participants
Last reply from:
acervergel87

Trending Topics

Online now

Members online
1,097
Guests online
1,375
Total visitors
2,472

Forum statistics

Threads
2,273,408
Posts
28,949,318
Members
1,235,739
Latest member
Angela012
Back
Top