misscomp9
02-27-2011, 02:56 PM
hy can anyone help me how to read data from notepad by using VB
i've tried this code but it wont work.. or can you edit or tell me what is my mistake here..
here are eg data in notepad
name id no sex maritalstatus
emma 011 f single
jimmy 022 m married
lim 033 m single
when i entered the code in VB, i can only read 1 line of my data. for e.g only emma details are came out.
Private Sub Command1_Click()
Dim name As Integer
Dim idno As String
Dim sex As String
Dim maritalstatus As Currency
Open "C:\Users\Documents\Data.Txt" For Input As #1
Input #1, strName, intidno, Strsex, strmarital status 'Read four variables from the file
Print strName, intidno, Strsex, strmarital status 'Print the Variables
Close #1 'Close the file
End Sub
how can i read data line by line by using loop. can anyone give me other example im newbie. thnks in advance.
i've tried this code but it wont work.. or can you edit or tell me what is my mistake here..
here are eg data in notepad
name id no sex maritalstatus
emma 011 f single
jimmy 022 m married
lim 033 m single
when i entered the code in VB, i can only read 1 line of my data. for e.g only emma details are came out.
Private Sub Command1_Click()
Dim name As Integer
Dim idno As String
Dim sex As String
Dim maritalstatus As Currency
Open "C:\Users\Documents\Data.Txt" For Input As #1
Input #1, strName, intidno, Strsex, strmarital status 'Read four variables from the file
Print strName, intidno, Strsex, strmarital status 'Print the Variables
Close #1 'Close the file
End Sub
how can i read data line by line by using loop. can anyone give me other example im newbie. thnks in advance.