👨‍🏫 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,264
Guests online
4,967
Total visitors
6,231

Forum statistics

Threads
2,305,640
Posts
29,166,967
Members
1,195,388
Latest member
theginnyman
Back
Top