Solved

Something wrong with Input #

Posted on 1998-06-04
2
132 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

679 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