Solved

Writing to a file without carriage returns VB6

Posted on 2001-06-27
3
312 Views
Last Modified: 2008-03-17
I have an array that I am writing to a file:

Open outputfile For Output As #2

For counter = 1 To Right1
    Print #2, Amount(counter)
Next


I get the text file, but I get a carriage return after each of the items.

Is there a way to do this without the carriage returns?

thanks
0
Comment
Question by:ataripirate
3 Comments
 
LVL 28

Accepted Solution

by:
AzraSound earned 25 total points
Comment Utility
each call to the Print command is placed on a new line, but you can do this with one statement in VB6:

Print #2, Join(Amount, " ")

the Join function takes an array and "joins" each element into a single string.  the second parameter passed to the function is the delimiter you wish to place between each array value.
0
 
LVL 7

Expert Comment

by:Joe_Griffith
Comment Utility
if you put a semicolon at the end of the print statement it will eliminate the carriage returns:

Open outputfile For Output As #2

For counter = 1 To Right1
   Print #2, Amount(counter);
Next
0
 

Author Comment

by:ataripirate
Comment Utility
thanks

Worked fine...
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now