display textbox text in report

I have created an application with vb2010 to manage contacts, a form which uses textboxes, checkboxes to edit or add contacts.
It also has a button to print a certain member currently display in the form.

What I would to know is, how can I display the text of several textboxes and checkbox on a report.

I have the following code:
Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        'PrintPage.ShowDialog()
        Dim name As Object
        Using report As New FastReport.Report()
            report.Load("Separate Member.frx")
            'report.RegisterData(dataSet1, "NorthWind")
            name.text = NameTextBox.Text
            report.Show()
        End Using
    End Sub

This is not working, can someone help me with this?

Thanks

Comments

  • edited 6:01AM
    Hello,

    You may use dialogue forms in a report:
    http://www.fast-report.com/documentation/U...alogueforms.htm
    If you want to print values from your app dialogue form, you may pass value using the report parameters:

    report.SetParameterValue("textBox1Text", textBox1.Text);

    and print this value in a report using the Text object:
    [textBox1Text]
  • edited 6:01AM
    Thanks for you reply.

    I have tried to use you example:
    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
            'PrintPage.ShowDialog()
            Using report As New FastReport.Report()
                report.Load("Separate Member.frx")
                report.SetParameterValue("NameTextBox.Text", NameTextBox.Text)
                report.Show()
            End Using
        End Sub
    

    And this is what I have created in the design report:
    Knipsel.jpg

    But when I run the application and click the button, the report is completely empty.

    I don't get why?

    Thanks
  • edited 6:01AM
    I figured out why the report was empty, I placed the textbox in the data band, when I placed it into new band (report summary) it was shown.

    The only thing I still saw, was that the dialog field contained the text as when I placed it when designed, while it should display the text of the textbox from my windows form.

    How to do this?
  • edited September 2011
    Remove '.' symbol from the parameter name and it will work.
  • edited September 2011
    AlexTZ wrote: »
    Remove '.' symbol from the parameter name and it will work.


    Thanks for your reply, I stopped using the dialogue (because it wasn't needed) and still it works, by using the setparametervalue.

    Thanks again for your help.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.