Link to home
Start Free TrialLog in
Avatar of FCapo
FCapo

asked on

Crystal Report Memory Error

Hi,

I`m running an application built in vb.net 2010, there's a form with a crystal report that's giving my some trouble. The program is installed on 5 PC's and only 1 of them is randomly giving me this error when I open up the form : attempted to read or write protected memory. this is often an indication that other memory is corrupt. - the program then crashes! The log describes that crystal report crashed because of this memory error.

There all running windows 7 pro 64bit...

I have no idea what's triggering it, and why only on this one computer! No one else gets this error!

Any help would be appreciated!
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FCapo
FCapo

ASKER

Hi Mlmcc,

Thank you for the help!

It turns out actually that everyone has this problem, I only realized it after I reset their computers!

I know what provokes the issue, please allow me to explain:

I've attached a screen capture just to explain better,

It's a timesheet program I built for my employees, allowing them to enter their hours and see a report of the hours they've entered!

In the screen capture (01.jpg), when they click on a day of the calendar, it filters the bindingsource in the datagridview to show only the hours of the employee for that particular day; then in the datagridview they can add/modify/delete records and proceed to save their changes.

The problem occurs when I click on the "Rapport" button, which opens up the form with the crystal report, of course the report and the program are both connecting to the same database and table.

The problem happens based on a sequence of events :
If when I first open the program I click on "Rapport", the report loads without any problems! But if when I first open the program, I click on the calendar and then click on "Rapport" then everything crashes with that memory error!

The code taking place when a user clicks the calendar is :
    Private Sub MonthCalendar1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MonthCalendar1.MouseDown
        FeuillesDeTempsDataGridView.AllowUserToAddRows = True
        If NCLDataSet.FeuillesDeTemps.GetChanges(DataRowState.Added + DataRowState.Modified + DataRowState.Deleted) IsNot Nothing Then
            If MessageBox.Show("Des changements ont été éffectués sur une feuille de temps sans les sauvegarder, voulez-vous sauvegarder les changements?", "Feuille De Temps", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = Windows.Forms.DialogResult.Yes Then
                Button1.PerformClick()
            End If
        End If

        Dim t As String = MonthCalendar1.SelectionStart.ToShortDateString
        Me.FeuillesDeTempsTableAdapter.FillBy(NCLDataSet.FeuillesDeTemps, empName, t)
        Total()
        Label6.Text = ""
        findProjet()

    End Sub

Open in new window

The Total() is used to calculate the totals at the bottom of the datagridview, the code is :

    Private Sub Total()

        Dim heures, km, heuresP, dep As Double

        For i = 0 To FeuillesDeTempsDataGridView.RowCount - 1
            If FeuillesDeTempsDataGridView.Rows(i).Cells(3).Value Is DBNull.Value = True Then
                FeuillesDeTempsDataGridView.Rows(i).Cells(3).Value = 0
            Else
                heures += FeuillesDeTempsDataGridView.Rows(i).Cells(3).Value

            End If

        Next

        For i = 0 To FeuillesDeTempsDataGridView.RowCount - 1
            If FeuillesDeTempsDataGridView.Rows(i).Cells(6).Value Is DBNull.Value = True Then
                FeuillesDeTempsDataGridView.Rows(i).Cells(6).Value = 0
            Else
                km += FeuillesDeTempsDataGridView.Rows(i).Cells(6).Value
            End If
        Next

        For i = 0 To FeuillesDeTempsDataGridView.RowCount - 1
            If FeuillesDeTempsDataGridView.Rows(i).Cells(4).Value Is DBNull.Value = True Then
                FeuillesDeTempsDataGridView.Rows(i).Cells(4).Value = 0
            Else

                heuresP += FeuillesDeTempsDataGridView.Rows(i).Cells(4).Value
            End If
        Next

        For i = 0 To FeuillesDeTempsDataGridView.RowCount - 1
            If FeuillesDeTempsDataGridView.Rows(i).Cells(5).Value Is DBNull.Value = True Then
                FeuillesDeTempsDataGridView.Rows(i).Cells(5).Value = 0
            Else

                dep += FeuillesDeTempsDataGridView.Rows(i).Cells(5).Value
            End If

        Next     

        txtHeures.Text = heures
        txtHeuresP.Text = heuresP
        txtKilo.Text = km
        txtDep.Text = FormatCurrency(dep)

    End Sub

Open in new window

I'm coding the application on my PC, which has win7 32bit installed, the app is being installed on 64bit win7 computers,

In the project settings, I set target CPU to x86 with .net framework 3.5

the form that has the crystal report has this code :
Public Class weeklyReport

    Private Sub weeklyReport_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        weeklyRpt1.Dispose()
    End Sub

    Private Sub weeklyReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        Dim param1Fileds As New CrystalDecisions.Shared.ParameterFields
        Dim param1Field As New CrystalDecisions.Shared.ParameterField
        Dim param1Range As New CrystalDecisions.Shared.ParameterDiscreteValue

        param1Field.ParameterFieldName = "paraName"
        param1Range.Value = My.Settings.empName
        param1Field.CurrentValues.Add(param1Range)
        param1Fileds.Add(param1Field)
        CrystalReportViewer1.ParameterFieldInfo = param1Fileds

    End Sub
End Class

Open in new window


Also on each of their computers, I installed CRforVS_redist_install_32bit_13_0_8

I tried installing the 64bit version of CRforVS but it gives me a different set of errors!

I really appreciate any help you can give me!

Thank you!
01.jpg