Link to home
Start Free TrialLog in
Avatar of Naithan Arroyo
Naithan ArroyoFlag for United States of America

asked on

Why Does Crystal reports, running in different thread, log in fail?

This code works when called on main thread.

Printlist ()

but fails when

ThreadPool.QueueUserWorkItem(AddressOf Printlist)

with a login error

this issue does not occur on my pc. (windows vista)


Ive tested and got the same error on 3 pc's
windows 2003
windows xp
windows vista

Public Sub Printlist()
        Try
 
            Dim crpt As New Lister
            Dim STRPath As String = AppDomain.CurrentDomain.BaseDirectory & "\cuurent.pdf"
            crpt.Refresh()
            crpt.SetDatabaseLogon("xx", "xxxxxxx")
 
            crpt.ExportToDisk(ExportFormatType.PortableDocFormat, STRPath)
            Dim MyProcess As New Process
            MyProcess.StartInfo.CreateNoWindow = False
            MyProcess.StartInfo.FileName = STRPath
            MyProcess.Start()
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
            TextBox66.Text = ex.ToString
        End Try
    End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Muhammad Kashif
Muhammad Kashif
Flag of Pakistan image

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 Naithan Arroyo

ASKER

Wow how did you find this out I searched EVERYWHERE for this simple issue.
Thank you VeryMuch