.Net Validation Methods
-
I am a newbie for VB.Net. i am trying to validate a textbox (only to put integers or strings). How Can I do That? Lasitha Kodikara lasithak5@sltnet.lk
-
I am a newbie for VB.Net. i am trying to validate a textbox (only to put integers or strings). How Can I do That? Lasitha Kodikara lasithak5@sltnet.lk
U can use Validation Controls Use Regular Expression Validator Or else U can go for Javascript/Vb Script "Aim to go where U have never been B4 and Strive to achieve it" http://groups.yahoo.com/subscribe/dotnetforfreshers http://himabinduvejella.blogspot.com
-
I am a newbie for VB.Net. i am trying to validate a textbox (only to put integers or strings). How Can I do That? Lasitha Kodikara lasithak5@sltnet.lk
In VS go to the left side drop down, select the text box, right side declarations, choose validating and this is how the code could look like. private Sub txtMiles_ Validationg(byval sender as object, _ by val e as System.ComponetModel.CancelEventArgs)_ Handels txtMiles.Validating Try Dim decMiles as Decimal = Convert.ToDecimal(txtMiles.Text) ErrorProvider1.SetError(txtMiles, ex.Message) Catch ex as Exception ErrorProvider1.Seterror(txtMiles, ex.Message) End Try End Sub If there were no God, there would be no Atheists. :-D