check it first with integer.tryparse

vb Code:
  1. if integer.tryparse(ctype(math.round(ctype(TextBox1.Text, decimal)), integer), number) then
  2.    number = ctype(math.round(ctype(TextBox1.Text, decimal)), integer)
  3. end if