views:

45

answers:

1

Hi all,

Ok, here is a weird VB.NET Grid problem. I am sure it is really simple, but it doesn't make sense to me.

I have a grid that displays data from a binding source. I have a method to handle the CellContentDoubleClick which will get the value of the cell and use that to do a new look up. This will generate a new datasource (with different columns) which I then rebind to the grid.

My grid double click works, but when it repaints with the new data, a single click fires the double click. This happens whether or not thre is a single click handler.

The interesting thing is that it is (in my case) a toggle. If I double click, on the repaint, a single click fires the double click code. When it repaints again, I need a double click.

The double click code fires off a messagebox - if I tell it not to continue, then I have to double click to get it to fire again. So it is not dependant on what data is displayed.

When it is in the mode to respond to a single click, I can tab through all the controls and then click on any cell in the grid and it will still fire the double click.

No matter what I try to do (set focus to other controls, refresh the grid, etc.) nothing seems to reset the grid so it works consistently.

Any ideas?

A: 

Ok, I found the answer. The data grid (at least in VS.Net 2007) has a property named "EditMode". If that is set to EditOnEnter (NOT the default) then you will experience this behavior. If you reset it (or change it to EditOnKeystrokeOrF2) then the datagrid will work as you expect (no single clicks acting like double clicks.)

This is after testing with threads, subclassed grids, you name it... I should have reviewed the property settings first.... grumble....

JustMe