943,977 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 5081
  • VB.NET RSS
Oct 20th, 2008
0

Validation using TryParse

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
3Dees is offline Offline
23 posts
since Sep 2008
Oct 20th, 2008
0

Re: Validation using TryParse

A double can be a 1 or a 1.2 or a .0034567. Just convert the entered number to a double.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: how can you create reports in vb.net without using crystal
Next Thread in VB.NET Forum Timeline: can someone tell me why my code isn't working?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC