How do I include exception handling?

paiswifintio

New Member
I'm creating a web form that takes user input for certain things and displays it after hitting Ok...but I don't have any way to check if the input is valid. VB is new to me and I would imagine "if" statements would work...but they don't seem like they do.\[code\]Public Class HelloForm Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Protected Sub cmdOk_Click(sender As Object, e As EventArgs) Handles cmdOk.Click msgLabel.Text = nameTextBox.Text + ", " + lastTextBox.Text + "; " + addrTextBox.Text + ", " + cityTextBox.Text + ", " + stateTextBox.Text + ", " + zipTextBox.Text + "; " + phoneTextBox.Text End SubEnd Class\[/code\]When I run this, everything works. But say if I include an invalid phone number or zip code (something). How and where do I include exception handling to do this?If I put in "asdhasd" into the Phone Number input, I want it to say "Invalid Phone Number".(I guess I probably should include a button that clears all output/input as well. ;x)
 
Back
Top