Helo all:

I have two dataGridViews on a form and id like to be able to extend the multiSelect property across both if them.

i.e. Id like to be able to hold down the ctrl key and click in dgv A AND dgv B and for them to hold those selections.

At the moment if I ctrl click in dgv A and then ctrl click in dgv B - all the elements selected in dgv A are cleared.

Am I being a little ambitious here or is this possible?

Thnx

Tino

Recommended Answers

All 2 Replies

I'm not sure if theres a built in way of doing it...but you could simulate it; Use the RowSelected event to change the background of the row to maintain the selected colour when the datagridview loses focus. Then each time a row is clicked use a List to store a record of the index of rows which were selected in each grid.
You'll need to catch the KeyDown event to trap whether teh CTRL key is down when rows are clicked.

If you need a hand with code i'll see what i can knock out later, tied up with work stuff at the mo. Have a go and shout if you get stuck.

I'm not sure if theres a built in way of doing it...but you could simulate it; Use the RowSelected event to change the background of the row to maintain the selected colour when the datagridview loses focus. Then each time a row is clicked use a List to store a record of the index of rows which were selected in each grid.
You'll need to catch the KeyDown event to trap whether teh CTRL key is down when rows are clicked.

If you need a hand with code i'll see what i can knock out later, tied up with work stuff at the mo. Have a go and shout if you get stuck.

Hi Ryshad

Thanks will give it a try tomorrow.

Thanks for the help

Tino

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.