6 Replies - 2714 Views - Last Post: 02 September 2013 - 08:42 AM Rate Topic: -----

#1 raelkun00  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 01-October 12

vshost32.exe has stopped working

Posted 02 September 2013 - 06:02 AM

This occurs when I preview my report for the second time. For example,I filter my report all dates that has month January and year 2013, It works fine. But if I close my report viewer and change my filter to month February and year 2013. This error occurs.

This is my code for filtering month and year.
Private Function getSalesReportByMonth()
        Dim dt As New DataTable
        Try
            Dim objCon As New dbConnect
            objCon.con.Open()
            Dim cmd As New OleDbCommand("Select * from SalesReport where MonthName(Month([sales_date]))=@month and Year(sales_date)=@year", objCon.con)
            cmd.Parameters.AddWithValue("@month", cboMonth.Text)
            cmd.Parameters.AddWithValue("@year", cboYear.Text)
            Dim da As New OleDbDataAdapter(cmd)
            da.Fill(dt)
            objCon.con.Close()
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
        Return dt
    End Function



This is my code for report viewer form.
Imports System.Data.OleDb
Public Class frmReportPreview
    Public dtPrint As New DataTable
    Public reportPath As String = ""
    Private Sub frmReportPreview_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        ReportPreview()
    End Sub
    Private Sub ReportPreview()
        Dim rptDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument = Nothing
        Try
            Windows.Forms.Cursor.Current = Cursors.WaitCursor
            If rptDocument Is Nothing Then
                rptDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument

            End If
            rptdocument.Load(Application.StartupPath & reportPath)

            rptdocument.SetDataSource(dtPrint)
            Me.CrystalReportViewer1.ReportSource = rptDocument

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
    End Sub



Is This A Good Question/Topic? 0
  • +

Replies To: vshost32.exe has stopped working

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3741
  • View blog
  • Posts: 13,090
  • Joined: 12-December 12

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 06:34 AM

If you go to the Project menu, Project Properties -> Debug ->(Check the) Enable unmanaged code debugging (or it might say native code debugging) then Clean and Build your project, it might generate a fuller, more useful, error message.

But also try re-booting your computer.
Was This Post Helpful? 0
  • +
  • -

#3 raelkun00  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 01-October 12

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 07:02 AM

I am now getting this error
Posted Image

I upload a video on youtube what's happening.
My link

This post has been edited by raelkun00: 02 September 2013 - 07:10 AM

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3741
  • View blog
  • Posts: 13,090
  • Joined: 12-December 12

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 08:09 AM

At least you have a different error message :)

Your first post suggests that it may a programming issue related to the filter you are applying. Test a number of different filters (making sure that something should match the filters) to determine whether the error is because of the filter, or a problem when showing the report viewer a second time.

But I can't really help you further, sorry, maybe someone else with Crystal Reports experience can.
Was This Post Helpful? 0
  • +
  • -

#5 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 977
  • Joined: 09-May 09

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 08:24 AM

Sounds like theres a handle on the report

dont know about crystal reports but its possible that when you load a report it held in memory, this must be disposed of before you can view it again

access violation would suggest the file is locked by another user (yourself) so you cannot read the contents
Was This Post Helpful? 1
  • +
  • -

#6 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3741
  • View blog
  • Posts: 13,090
  • Joined: 12-December 12

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 08:30 AM

Doh! deery5000 That should have occurred to me?!
Was This Post Helpful? 0
  • +
  • -

#7 raelkun00  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 70
  • Joined: 01-October 12

Re: vshost32.exe has stopped working

Posted 02 September 2013 - 08:42 AM

I solved my problem. It seems that the connection should not be close on my function. I just removed the code for closing the connection. Thanks Guys. ^_^
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1