This tutorial is all about How to Validate Double Value in VB.Net. With this tutorial you can Validate Double Value in VB.Net easily. So let’s get started:
- First is open the Visual Basic, Select File on the menu, then click New and create a new project.
- Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK
- Design your form like this just like what I’ve shown you below.
Add a Label, Button and Textbox.
- Add this following function.
- Function validateDoublesAndCurrency(ByVal stringValue As String) As Boolean
- Dim rslt As Boolean = False
- Dim value As Double
- Dim valueToTest As String = stringValue
- TryvalueToTest = Double.Parse(stringValue, Globalization.NumberStyles.Currency)
- Catch ex As ExceptionEnd Try
- If Double.TryParse(valueToTest, value) Then
- rslt = True
- rslt = False
- End If
- Return rslt
- End Function
- Then add this code to the button.
- Finally, Click F5 to run.
If you have any comments or suggestion about on How to Validate Double Value in VB.Net, Please Feel Free to contact our webpage.
Download How to Validate Double Value in VB.Net Code Here
Other articles you might read also:
- Regular Expressions
- How to Reorder List in Listbox using VB.Net
- Get List of Installed Fonts Using ListBox in VB.Net