Question

I have an UltraWinGrid and there is a test on a column to make sure the data entered does not already exists. If it exists, I show a MessageBox and I want the focus to be set on the cell again (to make sure the user enters something valid).

Right now, after the MessageBox appears, the selected cell by default is the next one. I tried this:

myUltraWinGrid.ActiveCell = e.Cell

I'm in the BeforeCellUpdate event so e.Cell refers to the cell I want to set the focus to..

Any ideas how I could do this ?

Était-ce utile?

La solution

You might try some of the UltraGridActon options available through PerformAction.

PrevCellByTab sounded like it might do what you want. It "Activates the previous visible cell relative to the ActiveCell and puts it into edit mode". If not, one of the other options may work.

ultraGrid1.PerformAction(UltraGridAction.PrevCellByTab)
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top