Results 1 to 3 of 3

Thread: VB.net how to pass variables to report viewer?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2008
    Posts
    68

    VB.net how to pass variables to report viewer?

    How to pass variables to report viewer?



    Dim name As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    name = "John"

    Form2.Show() 'form2 contain the report viewer control
    End Sub

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: VB.net how to pass variables to report viewer?

    It coul be done using parameters fields or formula fields in the rpt and 'filling' them in the vb app

    JG

  3. #3
    Member
    Join Date
    Aug 2010
    Location
    INDIA
    Posts
    33

    Re: VB.net how to pass variables to report viewer?

    Quote Originally Posted by nApzTEr View Post
    How to pass variables to report viewer?



    Dim name As String

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    name = "John"

    Form2.Show() 'form2 contain the report viewer control
    End Sub
    I am not .Net expert, but i am giving you a sample from what i have done with reporting. if found wrong kindly let me know :O)

    Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            Try
                 Form2.DataTableAdapter.Fill(Form2.Datatable, 'John')
                 Form2.ReportViewer1.LocalReport.RefreshReport()
            Catch ex As Exception
              .... ' Goes ur message box
             End Try
            'Form2.Show() 'form2 contain the report viewer control
        End Sub

Posting Permissions

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



Click Here to Expand Forum to Full Width