Results 1 to 4 of 4

Thread: Alittle confused on what purpose these characters make. . .little info please!

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    hello . . . i here is some code for the open command for the Commondialog . . . the code works great but
    'look after the code:
    _________________________
    Private Sub cmdOpen_click()
    Wrap$ = char(13) + char(10)
    Commondialog1.Filter = "Text Files (*.txt)|*.txt"
    Commondialog1.ShowOpen
    If commonDialog1.Filename <> "" then
    Open CommonDialog1.Filname for Input As #1
    Do until EOF(1)
    Line Input #1, LineOfText$
    AllText$ = ALLText$ & LineOfTExt$ & Wrap$
    Loop
    End if
    Exit Sub
    End Sub
    I was wondering what does the Wrap$ = char(13) + char(10) Do?
    i understand u Dim the Variable Wrap as string but the char(13) + char(10) do ?
    thanks for your time!


    ------------------
    Cory Sanchez

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,176

    Post

    CHR(10) is Carriage Return and CHR(13) is a LineFeed, instead you could just use the VB Constant vbCrLf, eg.
    Code:
    Private Sub cmdOpen_click()
        Commondialog1.Filter = "Text Files (*.txt)|*.txt"
        Commondialog1.ShowOpen
        If commonDialog1.Filename <> "" then
            Open CommonDialog1.Filname for Input As #1
            Do until EOF(1)
                Line Input #1, LineOfText$
                AllText$ = ALLText$ & LineOfTExt$ & vbCrLf
            Loop
        End if
    End Sub
    ------------------
    Aaron Young
    Analyst Programmer
    aarony@redwingsoftware.com
    adyoung@win.bright.net


    [This message has been edited by Aaron Young (edited 11-16-1999).]

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    It adds the Carriage Return + Line Feed. But you better use VB constants:

    strText = strText & vbCrLf & "NewLine"

    Regards,

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


  4. #4

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Post

    Alright thanks for the info . . . i hate it when i read boooks and they tell me out dated stuff not that it is outdated but they take the longer way.
    Thanks [b]Aaron Young[\b] and [b]Serge[\b]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width