We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

data bound grid displays 'Exception' in red in a cell when cell value is large

data bound grid displays 'Exception' in red in a cell when cell value is large. Want to handle it my self and display a truncated string in stead of 'Exception'. Any suggestions would be appreciated.
Following is the exception stack.

System.Runtime.InteropServices.ExternalException was unhandled
  Message="A generic error occurred in GDI+."
  Source="System.Drawing"
  ErrorCode=-2147467259
  StackTrace:
       at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
       at System.Drawing.Graphics.MeasureString(String text, Font font, Int32 width, StringFormat format)
       at Syncfusion.Windows.Forms.Grid.GridStaticCellModel.OnQueryPrefferedClientSize(Graphics g, Int32 rowIndex, Int32 colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
       at Syncfusion.Windows.Forms.Grid.GridCellModelBase.CalculatePreferredCellSize(Graphics g, Int32 rowIndex, Int32 colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
       at Syncfusion.Windows.Forms.Grid.GridModelColWidthsIndexer.ResizeToFit(GridRangeInfo range, GridResizeToFitOptions options)
       at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.ResizeVisibleRowsToFit(Boolean force)
       at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.ResizeVisibleRowsToFit()
       at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnVisibleChanged(EventArgs e)
       at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
       at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
       at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
       at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
       at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
       at CyberSecure.InitialFlow.showForm(Form frm) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\InitialFlow.cs:line 3075
       at CyberSecure.InitialFlow.ccAuditTrail_Click(Object sender, EventArgs e) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\InitialFlow.cs:line 2300
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.MenuStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at CyberSecure.AppMain.Main(String[] Args) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\AppMain.cs:line 91
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 



exception_in_grid_17df885b.zip

1 Reply

VK Vinish Kumar K Syncfusion Team August 7, 2013 02:31 AM UTC

Hi,

 

Sorry for the delay,

 

We have analyzed the reported query in our end,  In our samples we can able to enter a long text in Grid cell and we didn’t able to find any exception. This seems to be any painting / drawing exception. So please provide the below details to us this will help us to provide proper response asap.

 

1.       Let me know the frame work and Syncfusion essential studio version.

2.       Please let me know if you have used any drawing method or codes to draw the text in control

3.       Please provide any reproducible sample for analysis. This will help us to provide proper solution.

 

Regards,

Vinish K


Loader.
Live Chat Icon For mobile
Up arrow icon