CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Print# in VB

  1. #1
    Join Date
    Jul 2000
    Posts
    67

    Print# in VB

    Hello, and thank you for good answers earlier.

    I am using the print # function in VB, but having problems when i try to print to statements on the same line. My code looks like this:

    Open PrintFile For Append As #1
    sData = sData & fld.Name & ", "
    Print #1, sData
    aData = aData & fld.Address & ", "
    Print #1, aData
    Close#

    When I do it this way, VB starts on a new line each time it does a print#. I want it to print on the same line, and just add it in the end of the line..

    Thankful for all suggestions
    K.



  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Print# in VB

    If you add a semi-colon after the print statement, VB doesn't move on to the next line:


    '\\ print 1 - 10 on the same line
    for num = 1 to 10
    print #1, Str$(num) & "," ;
    next Num




    HTH,
    Duncan

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    Check out the new downloads - ImageMap.ocx is the VB control that emulates an HTML image map, EventVB.OCX for adding new events to your VB form and adding System Tray support simply, MCL Hotkey for implemenmting system-wide hotkeys in your application...all with source code included.
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Jul 2000
    Posts
    67

    Re: Print# in VB

    Thanks! Easy answer, but it helped me a lot!
    K.


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

Featured