DataGrid Big Red X error

hi ,

I have three different usercontols in a form , When i change a list box selection in one usercontrol , it runs a cdhart and displays it in another usercontrol , then it changes the datasource of the datagird and refreshes the datagrid in another user control.

Sometimes I m getting this big Red X on my winform application with a crash. 

i think its a thread error. 

here is a crash dump..

System.ArgumentException: Invalid parameter used.
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height)
at System.Drawing.Icon.ToBitmap()
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Control.WndProcException(Exception e)
at System.Windows.Forms.ControlNativeWindow.OnThreadException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)


Can any one help me out on this one ..

Thanks
vinothkumar


Answer this question

DataGrid Big Red X error

  • Mark Jordan

    hi ,

    I not using multiple threads , Its a single threaded app ..

    I have exception handler in place .. But this seems to be thread exception

    I think i have found the possible causes ,...pls refer to previous message ..



    Thanks 

    vinothkumar

  • tchris38

    Please provide the code you used to get this error, are you using error handlers  Do you have a line number the message points to (none seen here). Are you filling data in another thread

    ALso when changing the datagrids datasource, it's recomended that you set it to nothing and then to the new source.

  • Willem Termans

    hi people ,

    I just found the possible cause of this bug ..

    In Windows XP SP2 , there is bug that leaks MFC GDI objects 

    Each application has a maximum GDI utilization of 9999 objects.

    WHen the leak causes the Number of GDI objects to exceed 10,000 .

    IT causes the crash . This is the Microsoft link , 

    http://support.microsoft.com/default.aspx scid=kb;en-us;319740


    Thanks

    vinothkumar
    "I like u P0"

  • DataGrid Big Red X error