We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

currentcellvalidating and unxpected messagebox problem.

Thread ID:

Created:

Updated:

Platform:

Replies:

44852 Jun 5,2006 03:29 PM Jun 7,2006 12:09 PM Windows Forms 6
loading
Tags: GridControl
Philip Bishop
Asked On June 5, 2006 03:29 PM

While testing our app today I found a problem I cant track down. Run the attached sample. Click cell 1,1 once and then hold down the number 9 key until it maxes out the field with five 9''s. Now instead of clicking off or arrowing off the cell, hit f2 whiles its still in active edit mode. This will then give you my error message which is correct. Now if you click ok on my error message another message box shows up that has no message and only and ok button. It only does this when pressing f2. I just happened upon this on accident as one user likes using f2 to get in to edit mode rather then clicking the cell. Where is that message coming from and how can I stop it and why is it happening? Thanks in advance Phil

validation.zip

Administrator [Syncfusion]
Replied On June 6, 2006 12:51 AM

Hi Philip, The grid uses F2 Key to toggle between a cell in and out of edit mode. This might be interfering with your use of F2 Key. If you want to resolve this issue, try handling the F2 key in KeyDown event, and avoid the e.Cancel = true in the grid''s CurrentCellValidating event. Here is a code snippet. Dim IsF2Pressed As Boolean = False Private Sub grdAGCY_ACCR_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles grdAGCY_ACCR.KeyDown If e.KeyData = Keys.F2 Then IsF2Pressed = True Console.WriteLine(e.KeyData & "::::" & e.KeyValue) End If End Sub ''''''InCurrentcell validating event of the grid control. e.Cancel = Not IsF2Pressed IsF2Pressed = False Here is a modified sample. http://www.syncfusion.com/Support/user/uploads/validation_1df8e054.zip Please let me know if you need any further assistance. Best Regards, Haneef

Philip Bishop
Replied On June 6, 2006 08:41 AM

Ok so you didn’t answer my questions. I know what the F2 key does! I know it goes in to edit mode! In testing apps you need to try all possible combinations that you think might have an impact on the grid. After typing in an invalid amount and pressing F2 I get my error message which I should. What you didn’t answer is why am I getting that empty message box after my error message? I know pressing F2 gets me in edit mode, but what should happen if you are in edit mode and someone presses it again and it has to go to the validating event first and finds an error. I can’t imagine that is what is suppose to happen. Just some random empty message box with an ok button that appears for no reason???? Can you please explain what’s going on and why this is happening? I am not in a position where I can go in 500+ forms and add a key down to each form. Thanks.

Administrator [Syncfusion]
Replied On June 6, 2006 09:31 AM

Hi Phillip, We regret for the inconvenience caused. We were able to see the issue here and I have logged a bug report. You could track the progress of the issue here: http://www.syncfusion.com/support/issues/grid/Default.aspx?ToDo=view&questId=2186 Right now, you can use the below code snippet as a work-around. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.. You can try handling the grid''s KeyDown event to avoid this problem. Private Sub grdAGCY_ACCR_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles grdAGCY_ACCR.KeyDown Dim modifierKeys As Keys = Control.ModifierKeys Dim keyCode As Keys = e.KeyCode And Keys.KeyCode Dim controlKeyDown As Boolean = (e.Modifiers And Keys.Control) <> Keys.None Dim shiftKeyDown As Boolean = (e.Modifiers And Keys.Shift) <> Keys.None Dim extendSelection As Boolean = (modifierKeys And Keys.Shift) <> Keys.None Dim menuKeyDown As Boolean = (e.Modifiers And Keys.Menu) <> Keys.None Dim CurrentCell As GridCurrentCell = Me.grdAGCY_ACCR.CurrentCell Dim isHandled As Boolean = False If keyCode = Keys.F2 Then If Not controlKeyDown And Not menuKeyDown And Not shiftKeyDown Then If Not CurrentCell.IsEditing Then CurrentCell.BeginEdit() isHandled = True Else Try CurrentCell.EndEdit() CurrentCell.Refresh() Focus() Me.grdAGCY_ACCR.FixCurrentCellGotFocus() Catch ex As Exception If Not ExceptionManager.RaiseExceptionCatched(Me, ex) Then Throw ex End If Dim hasFocus As Boolean = Me.grdAGCY_ACCR.HasControlFocus If ex.Message.Length > 0 Then MessageBox.Show(FindFormHelper.FindForm(Me), ex.Message) End If If hasFocus And Not Me.ContainsFocus Then Focus() End If End Try isHandled = True End If End If End If e.Handled = isHandled End Sub >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.. Thanks for your patience, Best Regards, Haneef

Administrator [Syncfusion]
Replied On June 7, 2006 09:33 AM

Ok so I am confused now. Why are you sending me another sample of code that is different then the first sample you sent me?

Administrator [Syncfusion]
Replied On June 7, 2006 10:38 AM

Sorry to confuse you. The second suggestion only touches one event, not two events as did the first. This second suggestion is also more in line with what the eventual correction to our source code may look like as this code was copied from the GridControl.OnKeyDown source where the F2 key is currently handled. This copied code is slightly modified to avoid the second MessageBox that appears in the sample.

Administrator [Syncfusion]
Replied On June 7, 2006 12:09 PM

Well welcome back Clay!!! Thanks for the explanation. We will probably just wait for the new version on this one. Thanks again.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;