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.

DataGrid forgetting selection when inheriting DataGridTextBoxColumn to select a whole row when a cell is clicked

Thread ID:

Created:

Platform:

Replies:

29409 May 25,2005 02:56 AM Windows Forms 0
loading
Tags: FAQ
Rickard Liljeberg
Asked On May 25, 2005 02:56 AM

public class RegularColumn : DataGridTextBoxColumn { private int SelectedRow = -1; protected override void Edit(System.Windows.Forms.CurrencyManager source, int rowNum, System.Drawing.Rectangle bounds, bool readOnly,string instantText,bool cellIsVisible) { SelectedRow = rowNum; this.DataGridTableStyle.DataGrid.Select(SelectedRow); } ... This works fine so far that when i click a cell it selects the entire row. So far so good. But if i click another cell on another row i want that selected aswell... but when Edit is entered the next time the DataGrid has completely forgot the last selection and says that nothing is selected. So i get a single-select datagrid when iwant a multiselect. It works if i dont inherit Edit and instead use the RowHeader to select but i dont want to have a RowHeader thats why i want this solution to work. //Rickard

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.

;