-
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 = " " & vbCrLf And intlineCounter = 0
ÿ ÿ ÿ ÿ ÿ ÿ End If
Loop
ÿ Close #intBookFileNumber
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks