Dim TextValue As String = physicalroomstxt.Text.Trim()
If Not Regex.IsMatch(TextValue, "^[-\+]?(?:\d{1,3}|\d{1,3},\d{1,3}|\d{1,2},\d{1,3},\d{1,3})$") Then MessageBox.Show("Value must be numeric" & vbCrLf & _
"")
Me.physicalroomstxt.Text = "0"
End If

End Sub

But when it gets to past the third number the message box displays its "Value must be numeric"
Thanks JK

The ### may be on the right side instead of left (I'm doing this from memory). Anyhow, this formats a string with 1000's separators. Be aware that I think that by changing the value of a text box from within the textbox change text event you may refire that event in the process. You may need a flag to set while changing that ignores immediate changetext events until after it is changed.

Another possibility is the MaskedEditControl--I can't remember if it allows commas in the mask or not.
The Format command would be the simplest. # means can have a digit but not required. 0 means must have a digit here.

0

Featured Post

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…