Should it be:
if ( not IsNumeric(txtPCount.Text) or txtPCount.Text.Length > 46) then
Comparing a string against a number is probably giving you a problem. Also, to trap errors, you can use try..catch, there is a Page_Error event, there is an Application_Error event (in the global.asax), or you can display a custom error page.
You may want to check out my other thread at: http://p2p.wrox.com/topic.asp?TOPIC_ID=8551