Results 1 to 10 of 10

Thread: How to implement graphs/charts using crystal reports with visual basic 5.0

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    How to implement graphs/charts using crystal reports with visual basic 5.0

    Hi...
    I have problem that how to design graphs in vb 5.0 crystal reports and how to use then in vb 6.0 on button click.I am using vb 5.0 crystal reports in vb 6.0.
    Can any one plz let me the procedure to create graphs and implement then in vb6.0 on a button click

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    Moved to reporting section.

  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    VB Code:
    1. Function FunctionEval1(ByVal X As Double) As Double
    2.     ScriptControl1.ExecuteStatement "X=" & X
    3.     FunctionEval1 = ScriptControl1.Eval(Trim(Text1.Text))
    4. End Function
    5.  
    6. Function FunctionEval2(ByVal X As Double) As Double
    7.     ScriptControl1.AddCode "X=" & X
    8.     FunctionEval2 = ScriptControl1.Eval(Trim(Text2.Text))
    9. End Function
    10.  
    11. Private Sub Command1_Click()
    12. Dim t As Double
    13. Dim XMin As Double, XMax As Double, YMin As Double, YMax As Double
    14. Dim XPixels As Integer
    15.  
    16. On Error GoTo FncError
    17.     YMin = 1E+101: YMax = -1E+101
    18.     XMin = 2: XMax = 10
    19.     Picture1.Cls
    20.     Picture1.ScaleMode = 3
    21.     XPixels = Picture1.ScaleWidth - 1
    22.     Me.Caption = "Calculating range..."
    23.     Screen.MousePointer = vbHourglass
    24.     ' Calculate Min and Max for Y axis
    25.     For i = 1 To XPixels
    26.         t = XMin + (XMax - XMin) * i / XPixels
    27.         functionVal = FunctionEval1(t)
    28.         If functionVal > YMax Then YMax = functionVal
    29.         If functionVal < YMin Then YMin = functionVal
    30.     Next
    31.     Me.Caption = "Plotting function..."
    32.     ' Set up a user defined scale mode
    33.     Picture1.Scale (XMin, YMin)-(XMax, YMax)
    34.     Picture1.ForeColor = RGB(0, 0, 255)
    35.     ' Move to the first point
    36.     Picture1.PSet (XMin, FunctionEval1(XMin))
    37.     ' Plot the function
    38.     For i = 0 To XPixels
    39.         t = XMin + (XMax - XMin) * i / XPixels
    40.         'Picture1.PSet (t, FunctionEval1(t))
    41.         Picture1.Line -(t, FunctionEval1(t))
    42.     Next
    43.     Me.Caption = "Function Plot"
    44.     Screen.MousePointer = vbDefault
    45.     Exit Sub
    46. FncError:
    47.     MsgBox "There was an error in evaluating the function"
    48.     Screen.MousePointer = vbDefault
    49. End Sub
    50.  
    51. Private Sub Command2_Click()
    52. Dim t As Double
    53. Dim XMin As Double, XMax As Double, YMin As Double, YMax As Double
    54. Dim XPixels As Integer
    55.  
    56.     YMin = 1E+101: YMax = -1E+101
    57.     XMin = 2: XMax = 10
    58.     Picture1.Cls
    59.     Picture1.ScaleMode = 3
    60.     XPixels = Picture1.ScaleWidth - 1
    61.     Me.Caption = "Calculating range..."
    62.     Screen.MousePointer = vbHourglass
    63.     ' Calculate Min and Max for Y axis
    64.     For i = 0 To XPixels
    65.         t = XMin + (XMax - XMin) * i / XPixels
    66.         functionVal = FunctionEval2(t)
    67.         If functionVal > YMax Then YMax = functionVal
    68.         If functionVal < YMin Then YMin = functionVal
    69.     Next
    70.     Me.Caption = "Plotting function..."
    71.     ' Set up a user defined scale mode
    72.         Picture1.Scale (XMin, YMin)-(XMax, YMax)
    73.     Picture1.ForeColor = RGB(255, 0, 0)
    74.     ' Move to the first point
    75.     Picture1.PSet (XMin, FunctionEval1(XMin))
    76.     ' Plot the function
    77.     For i = 0 To XPixels - 1
    78.         t = XMin + (XMax - XMin) * i / XPixels
    79.         functionVal = FunctionEval2(t)
    80.         'Picture1.PSet (t, functionVal)
    81.         Picture1.Line -(t, functionVal)
    82.     Next
    83.     Me.Caption = "Function Plot"
    84.     Screen.MousePointer = vbDefault
    85.     Exit Sub
    86. FncError:
    87.     MsgBox "There was an error in evaluating the function"
    88.     Screen.MousePointer = vbDefault
    89. End Sub
    90.  
    91. Private Sub Command3_Click()
    92. Dim t As Double
    93. Dim XMin As Double, XMax As Double, YMin As Double, YMax As Double
    94. Dim XPixels As Integer
    95.  
    96.     YMin = 1E+101: YMax = -1E+101
    97.     XMin = 2: XMax = 10
    98.     Picture1.Cls
    99.     Picture1.ScaleMode = 3
    100.     XPixels = Picture1.ScaleWidth - 1
    101.     Me.Caption = "Calculating range..."
    102.     Screen.MousePointer = vbHourglass
    103.     ' Calculate Min and Max for Y axis
    104.     For i = 1 To XPixels
    105.         t = XMin + (XMax - XMin) * i / XPixels
    106.         functionVal = FunctionEval1(t)
    107.         If functionVal > YMax Then YMax = functionVal
    108.         If functionVal < YMin Then YMin = functionVal
    109.     Next
    110.  
    111.     Me.Caption = "Plotting functions..."
    112.     ' Set up a user defined scale mode
    113.     Picture1.Scale (XMin, YMin)-(XMax, YMax)
    114.  
    115.     Picture1.ForeColor = RGB(0, 0, 255)
    116.     ' Move to the first point
    117.     Picture1.PSet (XMin, FunctionEval1(XMin))
    118.     ' Plot the function
    119.     For i = 0 To XPixels
    120.         t = XMin + (XMax - XMin) * i / XPixels
    121.         'Picture1.PSet (t, FunctionEval1(t))
    122.         Picture1.Line -(t, FunctionEval1(t))
    123.     Next
    124.  
    125.     Picture1.ForeColor = RGB(255, 0, 0)
    126.     Picture1.PSet (XMin, FunctionEval2(XMin))
    127.     ' Plot the function
    128.     For i = 0 To XPixels
    129.         t = XMin + (XMax - XMin) * i / XPixels
    130.         'Picture1.PSet (t, FunctionEval2(t))
    131.         Picture1.Line -(t, FunctionEval2(t))
    132.     Next
    133.     Me.Caption = "Function Plot"
    134.     Screen.MousePointer = vbDefault
    135.     Exit Sub
    136. FncError:
    137.     MsgBox "There was an error in evaluating the function"
    138.     Screen.MousePointer = vbHourglass
    139. End Sub
    140.  
    141. Private Sub ScriptControl1_Error()
    142.     Debug.Print ScriptControl1.Error.Number
    143.     Debug.Print ScriptControl1.Error.Text
    144. End Sub

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    ok sure i will mark it.
    Can anyone reply back soon.

  5. #5

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    i didnt get the code
    can anyone plz
    1. how to create a graph by using crystal report in visual basic 5.0
    2. on a button click to display the graph according to the database in vb 6.0

  6. #6
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    if u want to create graph then make it there in the crystal report section and call it on vb

  7. #7

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    i created the graph in crystal report.But how to view the graph on button click in vb 6.0.
    Can anyone plz tell the steps to create the graph using crystal report (version 4.6) in vb5.0

  8. #8
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Arrow Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    Dim report as new crystal report
    Crystalreport1.path=”path of graph”
    Crystalreport1.action=1
    Don’t forget to add crystal report control at your form

  9. #9

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    I design the graph and include crystal report on the form and written the code.But on button click the report the not coming.
    1. can anyone please tell steps to crystal report(version 4.6) in vb 5.0
    2. How to print the graph on button click in vb 6.0
    Note: I included crystal report in vb6.0

  10. #10

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    53

    Re: How to implement graphs/charts using crystal reports with visual basic 5.0

    can anyone plz get me soon?

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