random System.FormatException when using the input panel

C

Claire

Pocket Pc 2003. Visual studio .net 2003 c#.

Ive a text box. I trap the key press events to make sure only numeric chars,
"-" "." and delete key are accepted.
Ive wrapped all the code in that event handler with a try/catch block.

If the input panel is open and I sit there tapping the non accepted keys for
random lengths of time I'll receive a System.FormatException in mscorlib.dll
which shuts down my form and application.
The catch block isn't entered, so I don't believe the problem's there. I've
also removed the event altogether, and it still happens.
I wondered if it was a problem with the small "auto string" (sorry, don't
know what its called) that comes up when the user types several characters
and ppc attempts to predict the whole word.

When the error is raised it drops back to a section of code where I open the
form having the problem. I check the code stack and there's nothing listed
in there after ShowDialog().

Has anyone else had problems with this? What can I do to prevent my app
closing down? Where can i trap it?
 
P

Peter Foot [MVP]

Can you post the block of code you are using to check the chars. A
FormatException is commonly raised if you try to interpret something as a
number when it isn't (e.g. using Integer.Parse()). We can't really help
without seeing the code you are using.

Peter
 
C

Claire

Thanks for answering Peter
I strongly believe the problem is associated to a buggy(?) OpenNetCF
smartlist control.
Testing the get/lose focus events of the textbox, to open/close an
InputPanel as appropriate, I would tap the smartlist to move focus away from
my textbox as it was the only other focusable control on my form that didn't
cause the form to close.
When I set focus back to the textbox, my code reopens the InputPanel. After
that, tapping on any character on the input panel would throw this error.
Ive no idea why/how there should be a bug like this, but I've found a few
really weird ones related to the SmartList just being present on the form so
Ive dumped it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top