Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Outofmemory issue on initializerow event
posted

Dear All,

I have used infragistics 11.1 version on my win application;

On initializerow event, i have set image on cells; it throws outofmemory exception on some of the machine.

My code is,

 Image anImage = Image.FromFile(iconsPath + "appointment.ico");

 uieCell.Cell.Appearance.Image = anImage;

Please let me know the way to fix this issue and it is very urgrent; please do the needful.

 

Thanks,

Vasanth

Parents
  • 469350
    Offline posted

    Hi Vasanth,

    If this code is in the InitializeRow event, then this is very inefficient. You are creating a new instance of the same image every time the event fires - and the event will fire multiple times for the same row. So you could be creating thousands of instances of the same image, which is a huge waste of memory.

    You are also forcing the creation of a new Appearance object for each cell.

    The efficient way to do this would be to create a set of Appearance objects - one for each appearance you need, and then apply those appearances to the cell(s) or columns.

    Take a look at the WinGrid Performance Guide. The section entitled Re-Use Appearances discusses this in detail.

Reply Children
No Data