Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Simple code to display a poem from file

Posted on 1999-07-07
2
Medium Priority
?
171 Views
Last Modified: 2010-05-02
I am using VB2 to learn the basics of VB.  I used a VB2 text as a reference to answer the task at hand.  This should be very easy but the code from the book did not work.
The question is to create a programme that  will
a) Allow the user to enter a poem into a text box
b) Allow the user to save to file
c) On form load, Load the poem from the file into the text box.

It is C that I have trouble with.  I manage to load the entire poem into a single string variable no problems.  According to my book, using a variable (NL) holding these values "chr$(13) & chr$(10)" would force a new line so that the poem is not one long line.

This didn't work.

Here is the code I used:

Sub Form_Load ()
  Dim Poem As String
  Dim PoemLine As String
  Dim count As Integer
  Dim NL As String
  NL = Chr$(13) & Chr$(10)
    Open "a:\Poem.txt" For Input As #1
    count = 1
    Do Until (EOF(1) = True)
        Input #1, PoemLine
        PoemLine = PoemLine
        'Poem = Poem & PoemLine
        txtPoem = txtPoem + NL & PoemLine
        count = count + 1
    Loop
    Close #1
    count = 0
   
    'Me!txtPoem = Poem
End Sub

This is the result I get in the text box:

This is line one of the poem This is line two of the poem This is line three of the poem This is line four of the poem

Except there are two black rectangles seperating each line.

Please Help

Billy.
0
Comment
Question by:billy21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
slgal earned 200 total points
ID: 1522635
Set the textbox's MultiLine property to true :>

0
 
LVL 6

Author Comment

by:billy21
ID: 1522636
Short and sweet.  Thank you very much.  I would have been coding for hours trying to get around this problem.  I didn't even think to check something so simple.

Thank you again.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
Suggested Courses

670 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