By Oleksandr Karpov - Tuesday, July 5, 2011
Dear Support, the NDataGridView has the SelectAll method that should select all rows/cells? but it does not. Any solution/idea? Thank you.
|
By Nevron Support - Tuesday, July 5, 2011
Hello Oleksandr,
Could you provide us with an example that demonstrates the problem because we cannot reproduce it? On our site this method works fine.
|
By Oleksandr Karpov - Tuesday, July 5, 2011
public partial class ImportInstructionsWizard : NForm{ DataGridViewRow dgvr = null;public ImportInstructionsWizard(){ InitializeComponent(); nDataGridView1.AutoGenerateColumns = false;nDataGridView1.Columns.Add( "Instruction", "Instruction");nDataGridView1.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;} public void AddInstruction(AbstractInstruction instruction){ nDataGridView1.Rows.Add(instruction.Description); dgvr = nDataGridView1.Rows[nDataGridView1.Rows.Count - 1]; dgvr.Cells[ "Instruction"].Tag = instruction;} private void nBtnImport_Click(object sender, EventArgs e){ DialogResult = System.Windows.Forms. DialogResult.OK;this.Close();} public void SelectAll(){ nDataGridView1.SelectAll(); } public DataGridViewSelectedCellCollection SelectedInstructions{ get{ return nDataGridView1.SelectedCells;} } private void nBtnCancel_Click(object sender, EventArgs e){ DialogResult = System.Windows.Forms. DialogResult.Cancel;Close(); } } I run it under Windows 7
|
By Oleksandr Karpov - Tuesday, July 5, 2011
btw, I run it under Windows 7
|
By Nevron Support - Wednesday, July 6, 2011
Hello Oleksandr,
We could not reproduce the problem that you described even with the described settings.
It works correctly when SelectAll was called.
|
By Oleksandr Karpov - Thursday, July 7, 2011
Hi, please take a look at this source code.
|
By Nevron Support - Thursday, July 7, 2011
Hi Oleksandr, Please, take a look at the attached, modified example. Click on Add Row button several times and then click on Select All button to select all rows and cells.
|
By Oleksandr Karpov - Monday, July 11, 2011
Dear Support, Thank you and yes, it works in that case. But it does not in this case (see the project attached) or at least for me. Please, check it - just run it and click the "Test ..." button. Thank you.
|
By Nevron Support - Monday, July 11, 2011
Hi Oleksandr,
You cannot select all rows and cells of NDataGridView before it was displayed. SelectAll method belongs to DataGridView control (NDataGridView derives from DataGridView) and this limitation comes from DataGridView control.
However, there is a workaround: Attach to ImportInstructionsWizard.Shown event and call ImportInstructionsWizard.SelectAll() in the Shown event handler instead of calling it before ShowDialog.
|
By Oleksandr Karpov - Tuesday, July 12, 2011
Yeah, Thank you.
|
|