Stop them entering the wrong type of data in the first place?
If you've got to the point of processing the data. If it goes wrong. Roll back any previous processing and throw some kind of error so you can get the user to fix. Ie stop your processing.
Also its not really good practice to use error handling to test data. if you know the input should be numeric, check before doing anything that would throw the error.
sub1
dim isOK boolean = false
while not isOK then
isOK = funct1()
end While
end sub1
funct1() as boolean
try
'bit that may fall over
return true
catch ex as exception
return false
end try
end func1
Just don't as you can get stuck in a loop.
Better
Code:
sub1 button_click()
if not isRubishData(txt1.text) then
'do processing
else
'Throw message at user
end if
end sub
function isRubishData(inData) as boolean
return whatever
end function
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.