| | |
read multi line txt.file and display in textbox
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2008
Posts: 25
Reputation:
Solved Threads: 0
i would like to read some data and display it in textbox.
my example of data in my txt file are:
"moviename1", "movieshowtime1"
"moviename2", "movieshowtime2"
when i display it in text box, it shows exactly like above.
i want it to display without the quotes.
how i can achive tat?
moviename1, movieshowtime1
moviename2, movieshowtime2
this is my code
my example of data in my txt file are:
"moviename1", "movieshowtime1"
"moviename2", "movieshowtime2"
when i display it in text box, it shows exactly like above.
i want it to display without the quotes.
how i can achive tat?
moviename1, movieshowtime1
moviename2, movieshowtime2
this is my code
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Private Sub Command1_Click() Dim dText As String, dNextLine As String, lLineCount As Long lLineCount = 1 Open "C:\Users\Chern\CINEMA\reserve.txt" For Input As #1 Do While Not EOF(1) Line Input #1, dNextLine dText = dText & dNextLine & vbCrLf Loop Text1.Text = dText End Sub
Hi,
Use the Replace function.
The syntax is Doing it in your code:
Chr$(34) is the " char.
Hope it helps.
Use the Replace function.
The syntax is
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Replace(string, find, replace)
VB Syntax (Toggle Plain Text)
Private Sub Command1_Click() Dim dText As String, dNextLine As String, lLineCount As Long lLineCount = 1 Open "C:\Users\Chern\CINEMA\reserve.txt" For Input As #1 Do While Not EOF(1) Line Input #1, dNextLine dNextLine = Replace(dNextLine, Chr$(34), "") dText = dText & dNextLine & vbCrLf Loop Text1.Text = dText End Sub
Hope it helps.
-- MartÃn
Use Input statement instead of Line Input
Ex
Ex
vb Syntax (Toggle Plain Text)
Private Sub Command1_Click() Dim dText As String Dim sString1 As String, sString2 As String Open "C:\Users\Chern\CINEMA\reserve.txt" For Input As #1 Do While Not EOF(1) Input #1, sString1, sString2 dText = dText & sString1 & ", " & sString2 & vbCrLf Loop Text1.Text = dText End Sub
Last edited by selvaganapathy; Jul 26th, 2008 at 1:59 pm.
KSG
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: string handling
- Next Thread: how to use a database multiple tables
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





