how to solve Report As New CrystalReport3 thisuserdefinend is not type error in vb0.6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gayatri mahajan
    New Member
    • Nov 2012
    • 5

    how to solve Report As New CrystalReport3 thisuserdefinend is not type error in vb0.6

    Code:
    Dim Report As New CrystalReport3
    
    Private Sub Command1_Click()
      Dim Report As New CrystalReport3
      Report.Export = True
       
    End Sub
    
    Private Sub Form_Load()
    Screen.MousePointer = vbHourglass
    CRViewer1.ReportSource = Report
    CRViewer1.ViewReport
    Screen.MousePointer = vbDefault
    
    End Sub
    how to solve Report As New CrystalReport3 this userdefinend is not type error in vb0.6
    Private Sub Form_Resize()
    CRViewer1.Top = 0
    CRViewer1.Left = 0
    CRViewer1.Height = ScaleHeight
    CRViewer1.Width = ScaleWidth
    
    End Sub
    Last edited by Meetee; Nov 29 '12, 05:44 AM. Reason: Use code tags <code/> around your code
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    You do not appear to have defined what the user-defined type CrystalReport3 refers to. You cannot use a user-defined type without declaring to what it refers.

    To use a crystal reports library you will have to declare a reference to it in your code - unless you do so you won't be able to use it at all.

    There are other problems with your code - your sub in lines 3 to 7 cannot do anything as you did not set the newly-created report to any value. As it will not have any contents, how can you export anything from it?

    -Stewart
    Last edited by Stewart Ross; Nov 29 '12, 01:34 PM.

    Comment

    • gayatri mahajan
      New Member
      • Nov 2012
      • 5

      #3
      i don't understood your answer

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        Perhaps you are not ready for using code libraries if you do not know how to set a reference to them.

        Have a look at the following link for further guidance on installing Crystal Reports in VB6. Section 10 shows you how to set a reference to the Crystal Reports control.


        This will not in itself help you to write useful code, as it can't tell you the steps you must follow. You have to work these out for yourself.

        As I said in my first reply, the sub you show in your original post cannot work as you have not set up the crystal reports object it refers to with any contents at all.

        You have written:

        Code:
        Dim Report As New CrystalReport3
        Report.Export = True
        How do you get from the Dim to the export? The report object has not been set to anything at all - there is no database involved, no report loaded, nor anything from what you have posted that could provide the declared object with something to export.

        -Stewart
        Last edited by Stewart Ross; Nov 29 '12, 07:33 PM.

        Comment

        Working...