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

ListBoxSelectionMode = MultiExtended and Del

Thread ID:

Created:

Updated:

Platform:

Replies:

30602 Jun 21,2005 03:09 AM Jun 21,2005 06:19 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 21, 2005 03:09 AM

My problem is that if I set ListBoxSelectionMode = MultiExtended on my GridControl and I select a cell in a row, pressing Del cleares the whole row. However, pasting text from the clipboard worx well, t.i. only the currently selected cell gets modified. If no current cell available (I select the whole row by clicking on the row header), only then pasting overwrites each cell in the row. Workaround?

Administrator [Syncfusion]
Replied On June 21, 2005 04:12 AM

Exactly what is the behavior you want to see that you do not see now?

Administrator [Syncfusion]
Replied On June 21, 2005 04:22 AM

If you do not want to clear rows, then you can handle the ClearingCells event and set e.Handled = true, doing nothing in this case.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	if(e.RangeList.ActiveRange.IsRows)
		e.Handled = true;
}
 

Administrator [Syncfusion]
Replied On June 21, 2005 04:43 AM

I simply want the following if I press Del: If no currentcell exists, then delete each cell in the selection. (This is, when I select a row clicking on the row header.) If there is a currentcell, then only the contents of that cell get deleted.

Administrator [Syncfusion]
Replied On June 21, 2005 05:12 AM

OK, now I can see your point: there''s always a currentcell: if I select the row clicking on the row header, then the header cell will be the currentcell. So, I use the ClearingCell event.

Administrator [Syncfusion]
Replied On June 21, 2005 06:19 AM

I think this event handler will do what you described.
private void gridControl1_ClearingCells(object sender, GridClearingCellsEventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(cc.ColIndex > 0 && !cc.IsEditing)
	{
		this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue = null;
		e.Handled = true;
		e.Result = true;
	}
}

CONFIRMATION

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.

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.

;