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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I delete rows from datagrid control

Thread ID:





1127 Sep 25,2002 02:07 AM UTC Sep 25,2002 05:26 AM UTC WinForms 1
Tags: FAQ
Asked On September 25, 2002 02:07 AM UTC

hi all, I want to delete rows from datagrid control on clicking a button. So I gave datagrid.SetDataBinding( null, null ); It is deleting all the rows, but it gives the following exception. Could any one give me a solution for this ? System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Windows.Forms.DataGrid.GetCellBounds(Int32 row, Int32 col) at System.Windows.Forms.DataGrid.GetCurrentCellBounds() at testdatagrid.OnPaint_datagrid(Object sender, PaintEventArgs e) at System.Windows.Forms.Control.OnPaint(PaintEventArgs e) at System.Windows.Forms.DataGrid.OnPaint(PaintEventArgs pe) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs) at System.Windows.Forms.Control.WmPaint(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) regards, lat.

Administrator [Syncfusion]
Replied On September 25, 2002 05:26 AM UTC

Before you reset the datasource, try setting the currentcell to 0,0. this.dataGrid1.CurrentCell = new DataGridCell(0, 0);


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon