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

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

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

Live Chat Icon For mobile
Up arrow icon