Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
A System.OutOfMemoryException always occurs in my program when the input data size becomes larger. Basically my program uses Xceed DataGrid i am trying to do Export 6000 records with 12 columns to XPS Document.

if(xceeddataGrid.ExportToXps(stream, pageSize, imageableArea, pageRange, CompressionOption.SuperFast, ExporttoXPSCallback, true, false))

Here i am getting OutOfMemoryException. i want to cancel export when memory is low using ExporttoXPSCallBack.

Please help me come out of it.
Posted

1 solution

You can guarantee that you never run into this exception. As you consume more and more memory, you can always exceed your budget.

However, in your case, you simply never need so many records at once. No user needs to see that many. You need to show limited portion of data at once, usually some 3-5 times of the volume the full screen can fit, no more. All other data should be loaded on request, by paging or using some other mechanism. This is the matter of proper design.

—SA
 
Share this answer
 
Comments
Raman Midha 23-Jul-13 4:52am    
We are also using Xceed Grid in Our Application where we allow user to access 2000 records at a time by using paging conrol. This functionality will increase the performance also.
hari111r 23-Jul-13 5:53am    
I am using data virtualization in my datagrid. I shows like all the records loaded. So i want to print all the records in the datagrid.
Sergey Alexandrovich Kryukov 23-Jul-13 10:23am    
Think a bit what your user might want...
—SA
Raman Midha 23-Jul-13 6:37am    
This can be implemented by using wpf datagrid. XceedDataGrid would not support to print large number of records.
Sergey Alexandrovich Kryukov 23-Jul-13 10:24am    
The real point is: would a large number make any sense? I believe, not all of them at a time...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900