Solved

Something wrong with Input #

Posted on 1998-06-04
2
129 Views
Last Modified: 2010-05-03
I'm trying to load a file into a textbox, but the file doesn't look like I want (as in Notepad). Here is my code:

    iFile = FreeFile
    Open sPath$ For Input As iFile%
    Do Until EOF(iFile%)
        Input #iFile%, sText$
        sReturn$ = sReturn$ & sText$ & Chr(13) & Chr(10)
    Loop
    Close #iFile%

First, all the indentations disappears (i.e. space characters). This app is about source code, so I really need the indentations. How can I transfer them to a standard textbox in VB?

Second, the comma character (ASCII 44) convert into a carriage return/linefeed sequence! Why? What can I do about it?

Regards, Gustaf Liljegren
0
Comment
Question by:liljegren
2 Comments
 
LVL 4

Accepted Solution

by:
martinag earned 100 total points
ID: 1462543
Use Line Input:
Line Input #iFile%, sText$

This reads the whole line instead of stopping at the first comma or ".
0
 

Author Comment

by:liljegren
ID: 1462544
Easy, but excellent! :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…

914 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

21 Experts available now in Live!

Get 1:1 Help Now