by
455 17

Numeric Validation on TextFields

Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1523352/Numeric-Validation-on-TextFields?startLine=0"></iframe>
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(",", ".") sender.select(sender.text.length, 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