Displaying blank line after 5 lines of


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Displaying blank line after 5 lines of

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Displaying blank line after 5 lines of

    [Originally posted by madeline lim]

    Thank you for your comments. However, I am having
    problems implenting your sugguestions. The code displays the five lines of details and then gets an error when trying to inserting the blank line.
    I am not sure what I did wrong. Here's my code
    and hopefully someone will have some sugguestions:

    I am reading a file from my directory and need the output to go to a text box and I should have a blank line after every five lines of detail from my file.

    Private Sub cmdDisplay_Click()

    Dim strBookFilePath As String
    Dim strBookId As String
    Dim strBookTitle As String
    Dim strBookTopic As String
    Dim strPublisherId As String
    Dim sngYearPublished As Single
    Dim sngPrice As Single
    Dim intcounter As Integer
    Dim intBookFileNumber As Integer
    Dim strTextString As String
    Dim intlineCounter As Integer

    cdlfiledialog.InitDir = App.Path
    cdlfiledialog.Filter = "Select File Name |*.txt; *.dat"
    cdlfiledialog.ShowOpen
    strBookFilePath = cdlfiledialog.FileName
    intBookFileNumber = FreeFile

    Open strBookFilePath For Input As #intBookFileNumber

    intcounter = 0
    intlineCounter = 0
    strTextString = ""
    Do While Not EOF(intBookFileNumber)
    intcounter = intcounter + 1
    intlineCounter = intlineCounter + 1

     
    Input #intBookFileNumber, strBookId, strBookTitle, strBookTopic, strPublisherId, sngYearPublished, sngPrice


      strTextString = strTextString & vbCrLf & intcounter & " " & strBookTopic & "  " & Left(strBookTitle, 30) & "   " & FormatCurrency(CStr(sngPrice))
     

    txtDisplayFile.Text = " Book Listing " & vbCrLf & strTextString
    If intlineCounter < 5 Then
    Else: txtDisplayFile.Text = &quot; &quot; & vbCrLf And intlineCounter = 0
    End If
    Loop
    Close #intBookFileNumber

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Displaying blank line after 5 lines of

    [Originally posted by John Citizen]

    Try this for your insert a blank line code

    txtDisplayFile.Text = " Book Listing " & vbCrLf & strTextString

    If intlineCounter < 5 Then
    Else
    txtDisplayFile.Text = txtDisplayFile.Text & vbCrLf
    intlineCounter = 0
    End If

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center