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

Copy entire grid to clipboard and possible bug

1. How do I select cells withing a grid programatically? 2. How do I copy the entire grid to the clipboard via code? 3. I have a MDI app with a grid running in a child window. The app is a simulator and the grid captures the data from the simulator while the simulation is running. For each iteration of the simulator, a new row is added to the grid and I call this.gridControl1.SetTopRow(this.gridControl1.RowCount); to keep showing the most current data. However, if I minimize the child window during the simulation, then stop the simulation, when I maximize the window with the grid I get the following exception. Note that I can't capture this exception. The firs line number in code that is referenced is line 388 which is Application.Run(new frmMain()); System.ArgumentException: '106' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'. at System.Windows.Forms.ScrollBar.set_Value(Int32 value) at Syncfusion.Windows.Forms.ReflectScrollBar.set_Value(Int32 value) at Syncfusion.Windows.Forms.ScrollBarWrapper.set_Value(Int32 value) at Syncfusion.Windows.Forms.Grid.GridScroll.DoScroll(GridDirectionType direction, Int32 nCell) at Syncfusion.Windows.Forms.Grid.GridControlBase.SetTopRow(Int32 rowIndex) at Syncfusion.Windows.Forms.Grid.GridControlBase.set_TopRowIndex(Int32 value) at Syncfusion.Windows.Forms.Grid.GridScroll.UpdateScrollbars(Boolean bRedraw, Boolean bOnlyIfDimensionChanged) at Syncfusion.Windows.Forms.Grid.GridScroll.UpdateScrollbars() at Syncfusion.Windows.Forms.Grid.GridControlBase.OnSizeChanged(EventArgs e) at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) at System.Windows.Forms.Control.UpdateBounds() at System.Windows.Forms.Control.WmWindowPosChanged(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at Syncfusion.Windows.Forms.ScrollControl.WndProc(Message& msg) at Syncfusion.Windows.Forms.Grid.GridControlBase.WndProc(Message& msg) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags) at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified) at System.Windows.Forms.LayoutManager.LayoutDockedControls(Control container, LayoutEventArgs levent) at System.Windows.Forms.LayoutManager.OnLayout(Control container, LayoutEventArgs levent) at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent) at System.Windows.Forms.Control.PerformLayout(Control affectedControl, String affectedProperty) at System.Windows.Forms.Control.OnResize(EventArgs e) at System.Windows.Forms.Form.OnResize(EventArgs e) at System.Windows.Forms.Control.OnSizeChanged(EventArgs e) at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight) at System.Windows.Forms.Control.UpdateBounds() at System.Windows.Forms.Control.WmMove(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DefMDIChildProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.Form.DefWndProc(Message& m) at System.Windows.Forms.Control.WmWindowPosChanged(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmWindowPosChanged(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DefMDIChildProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.Form.DefWndProc(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmSysCommand(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DefMDIChildProc(IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam) at System.Windows.Forms.Form.DefWndProc(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmNcButtonDown(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.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.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at DigitalComputations.Simware.frmMain.Main() in d:\dc master\simware\simware\frmmain.cs:line 388 --------------------------- OK ---------------------------

2 Replies

SH Sue Harris February 7, 2003 02:02 AM UTC

> 1. How do I select cells withing a grid programatically? I can answer this one, create a range and add it to the Selections collection: GridRangeInfo range = GridRangeInfo.Cells( top, left, bottom, right ); this.gridControl1.Selections.Add( range );


AD Administrator Syncfusion Team February 7, 2003 06:08 AM UTC

2. Use the CopyRange method. 3. It is best if you have a small sample project that demonstrates the problem, create a DirectTrac incident on our Support site and upload it there. That saves a lot of time trying to recreate the scenario you just described and we can more quickly find out what might be wrong with your or our code. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon