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

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

Replace(string, find, replace)

Doing it in your code:

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

Chr$(34) is the " char.

Hope it helps.

Use Input statement instead of Line Input

Ex

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

i have another problem, i wan it to appear like this
moviename1, movieshowtime1
moviename2, movieshowtime2

but it wont jump to second line, it stick together
moviename1,movieshowtime1moviename2,movieshowtime2

thanks for helping

thanks i solve my previous problem.
now another problem.
in my txt file :
moviename1, movieshowtime1
moviename2, movieshowtime2

i want to show only this in a text box. is that possible?
moviename1
moviename2

Hi, my above example will solve your problem. just modify the above example.

thanks alot =)

i want to read a list of ip adresses from a text file but line by line inorder to ping them and put each adress in a textbox

thnx for ur responses

@Djamel2010 : make your own thread dude..don't raise dead thread

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.