MT2090 THROWING ERROR WHILE SHOWING WAIT CURSOR CAUSES KEYBOARD TO NOT RESPOND

// Expert user has replied.
K Kenneth Ryan 3 years ago
0 9 0

6/9/2010 11:23 AM 3 Day Response MT2090 CE 5.0 I have a customer who is having an issue.  If you call listForm.ShowSpinner = True to and then throw and exception displaying an error message, the keyboard will no longer function.  This was displayed on VB_MT2000_Inventory where you can no longer type in text into the text box but not even the Left and Right Soft Keys work anymore. Is this a bug? Below is code section: Private Sub ReadLabelEventCallback(ByVal sender As Object, ByVal e As ReadLabelEventArgs)          ' invoke this method if required          If listForm.List.InvokeRequired Then             listForm.List.Invoke(readLabelEvent, sender, e)             Exit Sub          End If          If e.Result = RESULTCODE.E_OK AndAlso Not listForm.ShowSpinner Then             Dim ok As Boolean = True             Dim item As ScrollableListItem = listForm.List.SelectedItem             If item.Text = locationItem.Text Then                ok = GetNewLocation(True)             ElseIf item.Text = quantityItem.Text Then                ok = GetNewQuantity(True)             End If             If ok Then                ' ----------------------------------                ' HERE IS THE TEST:                ' BEGIN CHANGE                Try                   ' show the spinner because this may take a long time                   listForm.ShowSpinner = True                   ' add to inventory (same as sample)                   AddToInventory(e.LabelData.Text)                   ' oops, there was an error!                   Throw New Exception("Maybe we get an error popup.  The keypad won't work after this.")                Catch ex As Exception                   ' show a message box with the error                   MsgBox.Error(listForm, ex.Message)                Finally                   ' always hide the spinner after the process is complete                   listForm.ShowSpinner = False                   ' NOTE: You can work-around the bug by re-focusing the text box (un-comment the line below)                   ' Me.textBox.Focus()                   ' (this is not a good work-around because some of my apps don't have a text box on the screen)                End Try                ' END CHANGE                ' ----------------------------------             End If          End If          ' start another read          Program.ScannerServicesClient.BeginReadLabel()       End Sub

Please register or login to post a reply

9 Replies

L Li Chen

hmmmm, interesting...I am wondering if the issue is caused by spinner or the call to AddToInventory(e.LabelData.Text)... Anyone familiar with VB or this sample code, please feel free to chime in...

K Kenneth Ryan

I opened SPR 18888 on this issue.  Beyond my ability to debug but someone from ECRT should be able to figure it out.

K Kenneth Ryan

Will do.

K Kenneth Ryan

Even doing just MessageBox.Show causes the issue.  I took out the exception throwing. Private Sub ReadLabelEventCallback(ByVal sender As Object, ByVal e As ReadLabelEventArgs)          ' invoke this method if required          If listForm.List.InvokeRequired Then             listForm.List.Invoke(readLabelEvent, sender, e)             Exit Sub          End If          If e.Result = RESULTCODE.E_OK AndAlso Not listForm.ShowSpinner Then             Dim ok As Boolean = True             Dim item As ScrollableListItem = listForm.List.SelectedItem             If item.Text = locationItem.Text Then                ok = GetNewLocation(True)             ElseIf item.Text = quantityItem.Text Then                ok = GetNewQuantity(True)             End If             If ok Then                ' ----------------------------------                ' HERE IS THE TEST:                ' BEGIN CHANGE                     'Try                     ' show the spinner because this may take a long time                     listForm.ShowSpinner = True                     ' add to inventory (same as sample)                     AddToInventory(e.LabelData.Text)                     ' oops, there was an error!                     'Throw New Exception("Maybe we get an error popup.  The keypad won't work after this.")                     MessageBox.Show("Maybe we get an error popup.  The keypad won't work after this.")                     'Catch ex As Exception                     ' show a message box with the error                     'MsgBox.Error(listForm, ex.Message)                     'Finally                     ' always hide the spinner after the process is complete                     listForm.ShowSpinner = False                     ' NOTE: You can work-around the bug by re-focusing the text box (un-comment the line below)                     ' Me.textBox.Focus()                     ' (this is not a good work-around because some of my apps don't have a text box on the screen)                     'End Try                     ' END CHANGE                     ' ----------------------------------                 End If          End If          ' start another read          Program.ScannerServicesClient.BeginReadLabel()       End Sub

L Li Chen

Well, throwing exception is an expensive action. After the exception is thrown, how the device behaves depends on how the exception is handled...If the purpose is just to display an error msg, there is no need to throw an exception. But again, I am no expert in VB...maybe throwing exception is very common in VB, although I personally doubt that...?

K Kenneth Ryan

Li, Fact is customer is throwing the error while the wait cursor is up. I just need a response if the behavior of whether the keyboard input not being recognized when this occurs is within design or is a bug we would look at via the SPR process. I have tried to tell customer to go another way but they are insistent, so a yes or no on whether I should open an SPR or not is really what I need.

L Li Chen

What I meant is that when an exception is thrown and it is not handled properly, it will have some other effects. So, try to remove the exception throw and use the msg display call if all they need is just a error msg to see if it makes any difference...

L Li Chen

I am no expert on VB, but it sounds expensive to me that to display an error msg by throwing an exception...Is there something like Retailmsg in VB for messgae output?

K Kenneth Ryan

In .Net programming, whether C# or VB, throwing an excpetion and displaying a message is a fairly basic and mundane part of error handling.  There is really nothing that we can do to avoid this.  I mean this is not so focused on debugging, its more for displaying errors to an end user in case the device cant recover. The situation presented is just provided as a example to demonstrate the issue.

CONTACT
Can’t find what you’re looking for?