Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
How to Focus Particular Cell, after MessageBox Indication in "AfterRowUpdateEvent"?
posted

In cell Events and Key events, It is very easy to focus Particular Cell in the row.

But in case of AfterRowUpdate Event./ BeforeRowUpdate Event, i can't able to focus particular cell in that row, since focus shitfs to Some other Row where i click.

Here My Code:

IN AfterRowUpdate Event

If Ultragrid.Rows(i).Cells("Description").Value Is DBNull.Value Then
 

MessageBox.Show("Description can't be Left Empty", strMsgHeader,     MessageBoxButtons.OK,  MessageBoxIcon.Warning)

Ultragrid.Rows(i).Cells("Description").Activate()

 Return

End IF

 

 

  • 469350
    Offline posted

    Hi,

    If the user clicks on a cell, then they typically expect that cell to get focus. Or else, they expect the cell that had focus to retain focus and not allow them to leave (if the data fails validation, for example).

    So it's pretty unusual to put focus in some completely different cell than the one the user left or the one they clicked on.

    If that is what you are trying to do - then you could probably achieve this by moving your code into a method and calling that method using a BeginInvoke. That way, the grid will finish it's own processing of the click and put focus into the cell the user clicked before your code is executed.