| | |
Validation using TryParse
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2008
Posts: 23
Reputation:
Solved Threads: 0
Hej,
Hope someone can help me with this. Is there a Widows form method equivalent to console.readline? I am trying to validate and input using tryParse to ensure a doulbe is inputted if not display a error message. I got that to work eg when i input an A . But i don't want to continue unless a double is inputted. This is my code i tried but i am missing something:
Public Function IsDouble() As Boolean
IsDouble = True
Dim vDouble As Double
'Function required to validate input
If Not Double.TryParse(txtbox1.Text, vDouble) Then '
MessageBox.Show("enter a double please!")
txtValue.Clear()
Return IsDouble
End If
End Function
Hope someone can help me with this. Is there a Widows form method equivalent to console.readline? I am trying to validate and input using tryParse to ensure a doulbe is inputted if not display a error message. I got that to work eg when i input an A . But i don't want to continue unless a double is inputted. This is my code i tried but i am missing something:
Public Function IsDouble() As Boolean
IsDouble = True
Dim vDouble As Double
'Function required to validate input
If Not Double.TryParse(txtbox1.Text, vDouble) Then '
MessageBox.Show("enter a double please!")
txtValue.Clear()
Return IsDouble
End If
End Function
![]() |
Similar Threads
Other Threads in the VB.NET Forum
- Previous Thread: project topics?? (Database project) VB.NET
- Next Thread: can someone tell me why my code isn't working?
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





