455 17

Numeric Validation on TextFields

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
Imports System.Globalization Public Class Form 1 Private Sub SheetFromWeight_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim YourPreferableCulture as String = "en-US" CultureInfo.DefaultThreadCurrentCulture = New CultureInfo(YourPreferableCulture) CultureInfo.DefaultThreadCurrentUICulture = New CultureInfo(YourPreferableCulture) End Sub Private Sub Numbers_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged, TextBox3.TextChanged If Not IsNumeric(sender.Text) Then sender.text = "" If sender.Text.contains(",") Then sender.text = sender.text.replace(",", "."), 0) End If End Sub End Class
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus