Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

pls help..reading a text file n automatically changing it from vb..

ishraqishraq Member Posts: 20
hi,
i need sum help to change text from a text file automatically n then displaying it in a text box from vb..
eg:-
like if the text file contains text as following:

ball
orange
apple
rat
gum ball

now when i run the prog, it should put the above data from the text file into a text box in the form as follows..

ball;orange;apple;rat;gum ball

(in a straight line exactly as shown above)

can this be done?
thanks alot.. :)


Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    Which VB version are you using?

    VB6 and lower: Use the Open statement
    .NET language: Use StreamReader Object.
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • ishraqishraq Member Posts: 20
    : Which VB version are you using?
    :
    : VB6 and lower: Use the Open statement
    : .NET language: Use StreamReader Object.
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry


    hey thanx so much for replyn!..
    im using vb6
    i was up all last nite tryn to figure the code.. n finally i did it..
    but.. now i want te code to do sumthin else..pls help k?

    heres the code for the above q..

    Dim linecount As Integer, totsun As String, x As String

    Open "c: est.txt" For Input As #2
    linecount = 1
    Do While Not EOF(2)
    Line Input #2, totsun
    If totsun = "Axis-2" Then

    End If
    If x = "" Then
    x = totsun & ";"
    Else
    x = x & vbCrLf & totsun & ";"
    x = x & vbCrLf
    End If
    linecount = linecount + 1
    Loop

    Close #2

    but now i wud like the prog to do this... if the text file has text in a straight line as follows..

    gumbottle bee teeth bat creep

    now i wud like the prog to simply replace the spaces with ";"
    it must luk like

    gumbottle;bee;teeth;bat;creep

    is this possible? this may sound like a stupid project...but i really need it for sumthing... thanx!! :)
  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    Use Replace$.

    Good luck
    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • ishraqishraq Member Posts: 20
    : Use Replace$.
    :
    : Good luck
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry

    hey!
    works like a charm!! thanx!!!

    tc
Sign In or Register to comment.