Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Something wrong with Input #

Posted on 1998-06-04
2
Medium Priority
?
138 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 400 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

916 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