View: 2381|Reply: 6
|
Baca file dalam bentuk .txt dlm VB
[Copy link]
|
ieeya This user has been deleted
|
Hai.....sy ni baru nk belanja msk forum...klau silap maaf la ek!
Soalan sy; Cmner nak baca file yg dlm btk .txt dlm applikasi yg menggunakan vb |
|
|
|
|
|
|
ieeya This user has been deleted
|
Harap ada yg sudi membantu.......... |
|
|
|
|
|
|
|
dah tak ingat code dia dah...
something like this:
dim strText as String
Open "namafail.txt" For Input As #1
While Not Eof(1)
Line input #1, strText ' reads text from line to line
' pas tu buat la apa yang patut, nak masuk dalam text box ke...
Wend
Close(1) |
|
|
|
|
|
|
|
'read the file into array
Dim sr As System.IO.StreamReader = System.IO.File.OpenText("C:\Weapons.txt")
Dim StrArray() As String
Dim sData As String
'string = contents of file
sData = sr.ReadToEnd
'fill array with data
StrArray = Split(sData, ControlChars.NewLine)
'close stream
sr.Close() |
|
|
|
|
|
|
ieeya This user has been deleted
|
Teme kasih semua......Sy akan try semuanya... |
|
|
|
|
|
|
| |
|