hi,
I am running a windows service witch i want to create a pdf out of the data in the UltraWinGrid on a weekly basis.
The problem is setting the datasource in the grdReport.
(Me.grdReport.DataSource = Database)
The service doesnt crash,but the datasource wont update it remains empty. I think the problem is that it tries to create a "hidden GUI window", but a dont think a service is allowed to create a GUI window.
Does anybody know how to fixs this or is there another way of creating a pdf, perhaps without using GUI elements?
The code is something like this:
Protected Overrides Sub OnStart(ByVal args() As String) aTimer = New System.Timers.Timer(30000) AddHandler aTimer.Elapsed, AddressOf OnTimedEvent aTimer.Enabled = TrueEnd Sub
Private Sub OnTimedEvent(ByVal source As Object, ByVal e As ElapsedEventArgs)
..... database connection....
Dim strFileName As String = "c:\test\test2.pdf" Me.grdReport.DataSource = Database Me.expPdfExporter.Export(grdReport, strFileName, UltraWinGrid.DocumentExport.GridExportFileFormat.PDF)Catch ex As Exception
End Try
Hi,
I would recommend against using WinGrid within the code that executes within your Windows Service. Instead, you can create your PDF by using our Document Library directly. The only difference is that you will have to write code to iterate through your data and write it to the document using styles, layouts, and objects that you choose.
Here is a link to the Document Library help:
http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=Win_Infragistics_Document_Engine.html