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
220
retaining cell focus in ultrawingrid
posted

Hi,

I have a validation in place for a cell in ultrawingrid that user can not leave that cell as blank. The problem is - the grid shows the validation message after the user leaves that cell as blank but the focus goes to another cell where user clicks. is there any way I can retain the focus on the cell in question?

I am showing the validation message in BeforeCellUpdate event. Following is my code -

If TypeOf e.NewValue Is System.DBNull Then

Dim message As String = "The value for the cell can not be left blank"

MessageBox.Show(message, "Invalid value", MessageBoxButtons.OK, MessageBoxIcon.Error)

e.Cancel = True

'ugCanopySpecies.Focus()

e.Cell.Activate()

ugCanopySpecies.PerformAction(UltraGridAction.EnterEditMode)

'e.Cell.SelectAll()

Return

End If

and changing the value of rowupdatecancelaction does not make any difference.

thanks,

Mandeep. 

 

 

 

Parents
No Data
Reply
  • 37774
    posted

    If you want to prevent the user from leaving the cell, you should cancel the BeforeExitEditMode event instead of BeforeCellUpdate.

    -Matt

Children
No Data