Editingcontrolshowing cell validating

It is not important, it is CRITICAL - without it there would be no problem :-) The whole point of the process is to enable 'on the fly' addition of items to the combo within the grid.

Editingcontrolshowing cell validating

I assume that the problem is that we have already left the combo at the point at which all this change happens, but presumably there must be some sort of method to cause the cell to repaint itself using the newly stored value?

I would expect to call Invalidate or Repaint on a normal cell, but this does not work.

Hi Bob, OK, me being a dunce - hadn't connected up the On Cell Valdating event and was testing using a word you had already added to the list - boy do I feel stupid!

Yours works, but you are not using a sorted list or a data set, and are setting the Selected Index directly where I am setting the underlying selected value.

You are quite right about the Data Grid View - having written quite a number of specialied grids based upon it I am well aware of the issues involved, but this one has stumped me so far hence my question in the first place!

Chris Bray so are you configuring the Combo Box to allow you to type into that cell? We would not be having this conversation of that were not the case since none of the code presented to you for trapping and updating items that are not in the list would work...It has occurred to me that the answer may be to store the value locally to the grid and if it is greater than -1 reset it in the Validated event - or even when entering the subsequent column - but there is an awful lot of coding to do to prove whether that will work or not so I was hoping that someone would have come across this issue before and know the answer to what should be a fairly simple question.Adding to a list of items in a combo is a pretty common scenario, so I was hoping to avoid doing all that test coding only to find out that I was barking up the wrong tree!Even without using any of the above code if you reset the value of a Combo Box cell in the Validate event, you should have exactly the same problem i.e. Chris Bray The Data Grid View is never as easy to work with as you think--I could make a whole career just studying its idiosyncracies!!I believe that the key to this problem might be in the timing of events, where you set the value, and where you try to repaint the cell.The question is still the same simple one, and perhaps I have just given you too much information rather than too little as you at first suggested.

Tags: , ,