Exeption Question
Is there anyway to set the exception text?
I am loading an Oracle table that has a Clob data type. In some cases the text string returned can be very large (Clob can hold up to 2GB). I realize that the grid should not support this lenght for well known reasons. But is there a way that I can change the exception message?
For example instead of reading Exception, I would like to change it to something like, column can not be displayed due to size.
Let me know if you need screen shots or any additional followup information.
SIGN IN To post a reply.
6 Replies
AD
Administrator
Syncfusion Team
November 18, 2002 08:55 AM UTC
Ben,
Can you paste the CallStack that exists when the exception is trhown so we ca see exactly what message you are seeing?
To do so, in VisStu, under the Debug|Exceptions menu item, click on Common Language RunTime exceptions, and then click the Break into Debugger button under that window. Then when you run the program, the debugger should pop up when the exception is thrown, and you should be able to see the Call Stack window.
BB
Ben Bahrenburg
November 18, 2002 03:08 PM UTC
Please find the requested information below
system.drawing.dll!System.Drawing.Graphics::DrawString(String* s, System.Drawing.Font font = {Name="Microsoft Sans Serif" Size=8.25}, System.Drawing.Brush brush = {System.Drawing.SolidBrush}, System.Drawing.RectangleF layoutRectangle = {X=102.0 Y=56.0 Width=62.0 Height=14.0}, System.Drawing.StringFormat format = {System.Drawing.StringFormat}) + 0x135 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridStaticCellRenderer::_DrawText(System.Drawing.Graphics g = {System.Drawing.Graphics}, String* displayText, System.Drawing.Font font = {Name="Microsoft Sans Serif" Size=8.25}, System.Drawing.Rectangle textRectangle = {X=102 Y=56 Width=62 Height=14}, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}, System.Drawing.Color textColor = {RGB=0x0}, bool drawDisabled = false) + 0x1b4 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridStaticCellRenderer::OnDraw(System.Drawing.Graphics g = {System.Drawing.Graphics}, System.Drawing.Rectangle clientRectangle = {X=101 Y=55 Width=64 Height=16}, __int32 rowIndex = 3, __int32 colIndex = 2, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}) + 0x2a0 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridTextBoxCellRenderer::OnDraw(System.Drawing.Graphics g = {System.Drawing.Graphics}, System.Drawing.Rectangle clientRectangle = {X=101 Y=55 Width=64 Height=16}, __int32 rowIndex = 3, __int32 colIndex = 2, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}) + 0x8ac bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridCellRendererBase::Draw(System.Drawing.Graphics g = {System.Drawing.Graphics}, System.Drawing.Rectangle cellRectangle = {X=101 Y=55 Width=65 Height=17}, __int32 rowIndex = 3, __int32 colIndex = 2, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}) + 0xb7 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridStaticCellRenderer::Draw(System.Drawing.Graphics g = {System.Drawing.Graphics}, System.Drawing.Rectangle cellRectangle = {X=101 Y=55 Width=65 Height=17}, __int32 rowIndex = 3, __int32 colIndex = 2, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}) + 0x3c bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::OnDrawItem(System.Drawing.Graphics g = {System.Drawing.Graphics}, __int32 rowIndex = 3, __int32 colIndex = 2, System.Drawing.Rectangle rectItem = {X=101 Y=55 Width=65 Height=17}, Syncfusion.Windows.Forms.Grid.GridStyleInfo style = {Syncfusion.Windows.Forms.Grid.GridStyleInfo}) + 0x1b9 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridPaint::InternalDrawCell(Syncfusion.Windows.Forms.Grid.GridPaint.DrawStruct ds = {Syncfusion.Windows.Forms.Grid.GridPaint.DrawStruct}, __int32 rowIndex = 3, __int32 colIndex = 2, bool spannedOnly = false) + 0x1c8 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridPaint::DrawClientRowCol(__int32 topRow = 0, __int32 leftCol = 0, __int32 bottomRow = 9, __int32 rightCol = 3, System.Drawing.Graphics g = {System.Drawing.Graphics}) + 0x10f5 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::OnDrawClientRowCol(__int32 topRow = 0, __int32 leftCol = 0, __int32 bottomRow = 9, __int32 rightCol = 3, System.Drawing.Graphics g = {System.Drawing.Graphics}) + 0x2b bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridPaint::DrawGrid(System.Drawing.Graphics g = {System.Drawing.Graphics}) + 0x179 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridPaint::DrawGrid(System.Windows.Forms.PaintEventArgs pe = {ClipRectangle={X=0 Y=0 Width=368 Height=160}}) + 0x28 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::OnPaint(System.Windows.Forms.PaintEventArgs pe = {ClipRectangle={X=0 Y=0 Width=368 Height=160}}) + 0x16b bytes
system.windows.forms.dll!System.Windows.Forms.Control::PaintWithErrorHandling(System.Windows.Forms.PaintEventArgs e = {ClipRectangle={X=0 Y=0 Width=368 Height=160}}, short layer = 2, bool disposeEventArgs = false) + 0x85 bytes
system.windows.forms.dll!System.Windows.Forms.Control::WmPaint(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x29e bytes
system.windows.forms.dll!System.Windows.Forms.Control::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x293 bytes
syncfusion.shared.dll!Syncfusion.Windows.Forms.ScrollControl::WndProc(System.Windows.Forms.Message msg = {System.Windows.Forms.Message}) + 0x213 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::WndProc(System.Windows.Forms.Message msg = {System.Windows.Forms.Message}) + 0xac bytes
system.windows.forms.dll!ControlNativeWindow::OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x19 bytes
system.windows.forms.dll!ControlNativeWindow::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow::DebuggableCallback(__int32 hWnd = 591848, __int32 msg = 15, __int32 wparam = 0, __int32 lparam = 0) + 0x39 bytes
system.windows.forms.dll!System.Windows.Forms.Control::Update() + 0x1d bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::EndUpdate(bool update = true, bool fromModel = true) + 0x246 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridControlBase::ModelEndUpdateRequest(System.Object sender = {Syncfusion.Windows.Forms.Grid.GridDataBoundGridModel}, Syncfusion.Windows.Forms.Grid.GridEndUpdateRequestEventArgs e = {Syncfusion.Windows.Forms.Grid.GridEndUpdateRequestEventArgs}) + 0x2c bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModel::OnEndUpdateRequest(Syncfusion.Windows.Forms.Grid.GridEndUpdateRequestEventArgs e = {Syncfusion.Windows.Forms.Grid.GridEndUpdateRequestEventArgs}) + 0x23 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModel::EndUpdate(bool update = true) + 0x52 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModel::EndUpdate() + 0x16 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModelDataBinder::EndUpdateInternal() + 0x12 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModelDataBinder::Set_ListManager(System.Object newDataSource = {System.Data.DataSet}, String* newDataMember = "tblAssignee", bool force = false, bool forceColumnCreation = true) + 0x23c bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModelDataBinder::Set_ListManager(System.Object newDataSource = {System.Data.DataSet}, String* newDataMember = "tblAssignee", bool force = false) + 0x20 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridModelDataBinder::set_DataMember(String* value = "tblAssignee") + 0x45 bytes
syncfusion.grid.dll!Syncfusion.Windows.Forms.Grid.GridDataBoundGrid::set_DataMember(String* value = "tblAssignee") + 0x24 bytes
> GridTest3.exe!GridTest3.Form1.LoadGrid() Line 167 + 0x1d bytes Basic
GridTest3.exe!GridTest3.Form1.Button1_Click(Object sender = {System.Windows.Forms.Button}, System.EventArgs e = {System.EventArgs}) Line 123 + 0xa bytes Basic
system.windows.forms.dll!System.Windows.Forms.Control::OnClick(System.EventArgs e = {System.EventArgs}) + 0x62 bytes
system.windows.forms.dll!System.Windows.Forms.Button::OnClick(System.EventArgs e = {System.EventArgs}) + 0x38 bytes
system.windows.forms.dll!System.Windows.Forms.Button::OnMouseUp(System.Windows.Forms.MouseEventArgs mevent = {X=128 Y=5 Button=Left}) + 0x11c bytes
system.windows.forms.dll!System.Windows.Forms.Control::WmMouseUp(System.Windows.Forms.Message m = {System.Windows.Forms.Message}, System.Windows.Forms.MouseButtons button = Left, __int32 clicks = 1) + 0x235 bytes
system.windows.forms.dll!System.Windows.Forms.Control::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x481 bytes
system.windows.forms.dll!System.Windows.Forms.ButtonBase::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x11a bytes
system.windows.forms.dll!System.Windows.Forms.Button::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x8d bytes
system.windows.forms.dll!ControlNativeWindow::OnMessage(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0x19 bytes
system.windows.forms.dll!ControlNativeWindow::WndProc(System.Windows.Forms.Message m = {System.Windows.Forms.Message}) + 0xda bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow::DebuggableCallback(__int32 hWnd = 591866, __int32 msg = 514, __int32 wparam = 0, __int32 lparam = 327808) + 0x39 bytes
system.windows.forms.dll!System.Windows.Forms.Application::ComponentManagerSystem.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(__int32 dwComponentID = 1, __int32 reason = -1, __int32 pvLoopData = 0) + 0x2c1 bytes
system.windows.forms.dll!ThreadContext::RunMessageLoop(__int32 reason = -1, System.Windows.Forms.ApplicationContext context = {System.Windows.Forms.ApplicationContext}) + 0x1c5 bytes
system.windows.forms.dll!System.Windows.Forms.Application::Run(System.Windows.Forms.Form mainForm = {GridTest3.Form1}) + 0x36 bytes
GridTest3.exe!GridTest3.Form1.Main() Line 7 + 0x1d bytes Basic
> Ben,
>
> Can you paste the CallStack that exists when the exception is trhown so we ca see exactly what message you are seeing?
>
> To do so, in VisStu, under the Debug|Exceptions menu item, click on Common Language RunTime exceptions, and then click the Break into Debugger button under that window. Then when you run the program, the debugger should pop up when the exception is thrown, and you should be able to see the Call Stack window.
>
AD
Administrator
Syncfusion Team
November 18, 2002 05:07 PM UTC
If you know in advance which columns cannot be displayed, then the easiest thing to do would be to remove them up front, that way no error would be thrown. You can either explicilty add GridBoundColumns for only your 'good' columns. Or, you could take the GridDataBoundGrid.Binder.InternalCOlumns and remove the 'bad' ones.
If you want to try to avoid the error on the fly, you can handle PrepareViewStyleInfo, and if the e.Style.Text is too large, set it to "" (or maybe set your error message to the text at this point). This way, Essntial Grid will not try to draw the huge text which is what seems to be causing the exception.
BB
Ben Bahrenburg
November 18, 2002 09:31 PM UTC
The issue is that I will not be able to tell in advance if the value will be to large.
Do you have a sample of using the PrepareViewStyleInfo in the way you described?
BB
Ben Bahrenburg
November 19, 2002 11:25 AM UTC
Thank you for your assistance.
What is the max column size planned to be supported?
I have come up with an example similar to
Private Sub Grid1_PrepareViewStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs) Handles Grid1.PrepareViewStyleInfo
If e.Style.Text.Length > 355 Then e.Style.Error = "String To Long"
End Sub
AD
Administrator
Syncfusion Team
November 19, 2002 11:53 AM UTC
The exception is being thrown done in the GDI+ DrawString method.
I did not not see a particular limitation noted in the MS docs for this method. The string.Length property is a 32-bit integer so I suspect that is one limitation. But I also suspect that DrawString will not handle that much text. A more reasonable limit might be what you would expect to be useful for the user to see in a grid cell.
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
BB Ben Bahrenburg
- Nov 18, 2002 01:01 AM UTC
- Nov 19, 2002 11:53 AM UTC