Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Beginner for creating Crystal Report with VB.NET2008 WinForm

Beginner for creating Crystal Report with VB.NET2008 WinForm

Scheduled Pinned Locked Moved Visual Basic
databasecsharpmysqlhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    drexler_kk
    wrote on last edited by
    #1

    Hello all,I'm new to using Crystal Reports and VB.NET Programming here. I have try to Google for how it works. Currently I'm able to show my Blank Reports by Clicking a Button2. I have to ask anyone can tell me how to display my data using the Crystal Report? The following are the code I'm currently working with:

    'When the following button Click,the Report will showout.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Dim objRpt As New FrmCrystalRpt
    objRpt.strRptName = New CachedCrystalReport1

        objRpt.Show()
    
    End Sub
    

    'The below is my ReportViewer WinForm
    Public Class FrmCrystalRpt
    Public strRptName As Object
    Public strRptFilter As String

    Private Sub FrmCrystalRpt\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If strRptFilter <> "" Then
            crptVW.SelectionFormula = strRptFilter
        End If
        crptVW.ReportSource = strRptName
        crptVW.Show()
    
    End Sub
    

    End Class

    Currently my report showing nothing,I'm wondering how could I make this report show my selection of data from the MySQL5.0 database? I'm using MySQL ODBC3.51 Driver to connect my Database=logistic_sysdb. I wish the Crystal Report can show my selection of data below:

    Dim SQL4 As String
    selectmonth = ComboBox2.SelectedItem

        SQL4 = "SELECT \* FROM lorry\_commission WHERE Lorry\_No='" & ComboBox1.SelectedItem & "' AND MONTH(Date)='" & selectmonth & "';"
       
        Try
            ObjMyConn.Open()
            ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
            ObjAdapter.Fill(ds, "Salary44")
        Catch ex As Exception
            MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly)
        Finally
            ObjMyConn.Close()
        End Try
    

    I guess some parameter is needed to be passed into the Crystal Report as well. How to do that? Anyone can give me a sample is better so I can learn easier to solve this. Thanks for reading. Drex

    A 1 Reply Last reply
    0
    • D drexler_kk

      Hello all,I'm new to using Crystal Reports and VB.NET Programming here. I have try to Google for how it works. Currently I'm able to show my Blank Reports by Clicking a Button2. I have to ask anyone can tell me how to display my data using the Crystal Report? The following are the code I'm currently working with:

      'When the following button Click,the Report will showout.
      Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      Dim objRpt As New FrmCrystalRpt
      objRpt.strRptName = New CachedCrystalReport1

          objRpt.Show()
      
      End Sub
      

      'The below is my ReportViewer WinForm
      Public Class FrmCrystalRpt
      Public strRptName As Object
      Public strRptFilter As String

      Private Sub FrmCrystalRpt\_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          If strRptFilter <> "" Then
              crptVW.SelectionFormula = strRptFilter
          End If
          crptVW.ReportSource = strRptName
          crptVW.Show()
      
      End Sub
      

      End Class

      Currently my report showing nothing,I'm wondering how could I make this report show my selection of data from the MySQL5.0 database? I'm using MySQL ODBC3.51 Driver to connect my Database=logistic_sysdb. I wish the Crystal Report can show my selection of data below:

      Dim SQL4 As String
      selectmonth = ComboBox2.SelectedItem

          SQL4 = "SELECT \* FROM lorry\_commission WHERE Lorry\_No='" & ComboBox1.SelectedItem & "' AND MONTH(Date)='" & selectmonth & "';"
         
          Try
              ObjMyConn.Open()
              ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
              ObjAdapter.Fill(ds, "Salary44")
          Catch ex As Exception
              MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly)
          Finally
              ObjMyConn.Close()
          End Try
      

      I guess some parameter is needed to be passed into the Crystal Report as well. How to do that? Anyone can give me a sample is better so I can learn easier to solve this. Thanks for reading. Drex

      A Offline
      A Offline
      ABitSmart
      wrote on last edited by
      #2

      You would need to assign a DataSource to the report. Take a look at this article [^]

      D 1 Reply Last reply
      0
      • A ABitSmart

        You would need to assign a DataSource to the report. Take a look at this article [^]

        D Offline
        D Offline
        drexler_kk
        wrote on last edited by
        #3

        I'm still wondering how to use that Crystal Report? Anyone can let me know how to show a dataset table result using a Crystal Report after clicking a button? And how can I pass 3 string parameter to the Crystal report? Thanks for reading. Drex

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups