dcsimg
Results 1 to 11 of 11

Thread: How to keep the format of a multiline textbox the same in DataReport?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    How to keep the format of a multiline textbox the same in DataReport?

    Hello everyone
    I'm using a datareport for printing a multiline textbox but I can't keep the same layout of the textbox.
    My textbox looks like this:
    Name:  111.png
Views: 150
Size:  1.5 KB
    But the printing output is this:
    Name:  2222.png
Views: 148
Size:  1.4 KB
    Any idea please?
    thank you

  2. #2
    PowerPoster
    Join Date
    Oct 2013
    Posts
    3,161

    Re: How to keep the format of a multiline textbox the same in DataReport?

    Maybe use a fixed font and align with spaces?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    Arnoutdv
    Thanks for answering me but I did not understand.

    I created a form and added a multiline text with the same formatting as above
    And I adde a label with the same font as the textbox0
    Then:
    Code:
    Label1.caption = Text1.Text
    But the output is the same as the example above.
    Thank you

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    31,773

    Re: How to keep the format of a multiline textbox the same in DataReport?

    It looks like it is being centered... check the font settings on the report, make sure it isn't set to align center.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    Thanks techgnome

    I checked the font and the alignemen but still the problem.
    I think because I'm filling the textbox from a listview.
    Code:
    Text3.Text =  Item.Text & vbNewLine & vbTab & vbTab & _
            Item.ListSubItems(2).Text
    When I filled the textbox manually, It worked with a form label but doesn't work with RPTLabel.
    I don't know if ther is a way to overcome this issue.
    thanks
    Last edited by samer22; Sep 16th, 2018 at 12:19 PM.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    This what I did

    Code:
    DataReport1.Sections("Section1").Controls("Label1").Caption = Text3.Text
    but didn' t work
    Then I used a RptTextbox with a temporary table but the same problem.
    Any help please?

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,074

    Re: How to keep the format of a multiline textbox the same in DataReport?

    When the DataReport renders a RptTextBox it does not expand TAB characters. As far as I can tell it just treats them as whitespace, rendering each occurrence as a space.

    RptTextBox isn't really that much like a TextBox and isn't really a control at all. The DataReport "controls" are really only controls during design time. At runtime they are layout rendering operations.

    Maybe what you really want is two RptTextBox instances, one left justified and one right justified?

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    dilettante
    Maybe what you really want is two RptTextBox instances, one left justified and one right justified?
    Thank you for this proposal
    But How Am I going to copy the content of the textbox to the two RptLabels?
    Is the Split function going to do the job?
    thanks sir

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    19,074

    Re: How to keep the format of a multiline textbox the same in DataReport?

    Sure, you could Split() on vbNewLine or you might Split() and then use Mid$() on the second element of the resulting String array to strip off your two TAB characters.

    Or you could replace your TextBox with two MultiLine = False TextBox controls.

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    dilettante
    thanks again
    I did as you told me
    I created two RptLabels and I used the split function.
    Code:
    Dim strText() As String
    strText = Split(Text3.Text, vbCrLf)
    DataReport1.Sections("Section1").Controls("Label1").Caption = = strText (2) & vbCrLf & strText(4)   & _
     vbCrLf & strText(6) & vbCrLf & strText(8) & vbCrLf & strText(10) & vbCrLf & strText(12) & vbCrLf & strText(14)
    
    DataReport1.Sections("Section1").Controls("Label2").Caption = strText (3) & vbCrLf & strText(5)   & _
     vbCrLf & strText(7) & vbCrLf & strText(9) & vbCrLf & strText(11) & vbCrLf & strText(13) & vbCrLf & strText(15)
    
    
    End Sub
    I'm getting exactly what I want.
    However I'm having a slight problem.
    If the number of lines in the textbox and the array is not the same, I get error subscript out of range.
    thank you
    Last edited by samer22; Sep 17th, 2018 at 04:56 AM.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2013
    Posts
    612

    Re: How to keep the format of a multiline textbox the same in DataReport?

    Please I need an expert to show me how to make two loops that grab the specified lines for each RPTlabel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width