Profile Picture

NDataGridView SelectAll

Posted By Oleksandr Karpov 13 Years Ago
Author
Message
Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1

Yeah,

Thank you.



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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.

Best Regards,
Nevron Support Team



Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1

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.



Attachments
TestNevronSelectAll.zip (183 views, 18.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009

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.



Best Regards,
Nevron Support Team



Attachments
Example.zip (162 views, 3.00 KB)
Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1

Hi,

please take a look at this source code.



Attachments
Example.zip (168 views, 3.00 KB)
Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hello Oleksandr,

We could not reproduce the problem that you described even with the described settings.

It works correctly when SelectAll was called.


Best Regards,
Nevron Support Team



Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1
btw, I run it under Windows 7

Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1

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



Nevron Support
Posted 13 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
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.

Best Regards,
Nevron Support Team



Oleksandr Karpov
Posted 13 Years Ago
View Quick Profile
Junior Member

Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 14, Visits: 1

Dear Support,

the NDataGridView has the SelectAll method that should select all rows/cells? but it does not.

Any solution/idea?

Thank you.





Similar Topics


Reading This Topic