hadinatayp
Well-known member
- Joined
- Feb 8, 2006
- Messages
- 95
- Programming Experience
- Beginner
i have to validate input for number (integer type) and price (double type),
i would code something like,
------------------------------------------
dim tempNumber as integer
dim tempPrice as double
try
tempNumber=convert.toint32(txtnumber.text)
tempPrice=convert.todouble(txtprice.text)
catch ex as formatException
messagebox.show("Error Number input")
txtnumber.focus()
end try
----------------------------------------
if i enter a string in the Number textbox the try block will catch the exception and display the error message (for the number), same thing will happend if i put a string in price textbox (suppose i enter an integer in the number textbox) (the message will show up stating error in number textbox)
the problem is how make a new exception that catch the double format exception and show the appropriate error message (for the price textbox)
thanks.
i would code something like,
------------------------------------------
dim tempNumber as integer
dim tempPrice as double
try
tempNumber=convert.toint32(txtnumber.text)
tempPrice=convert.todouble(txtprice.text)
catch ex as formatException
messagebox.show("Error Number input")
txtnumber.focus()
end try
----------------------------------------
if i enter a string in the Number textbox the try block will catch the exception and display the error message (for the number), same thing will happend if i put a string in price textbox (suppose i enter an integer in the number textbox) (the message will show up stating error in number textbox)
the problem is how make a new exception that catch the double format exception and show the appropriate error message (for the price textbox)
thanks.