Peter,
Do you want a well formed value in the textbox or just those characters?
Here is a sample RegEx used in the Validating event of the TextBox for jsut
those characters (not well formed).
Private Sub TextBox1_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating
Const pattern As String = "^[\d./+-^,]+$"
Static theRegex As New System.Text.RegularExpressions.Regex(pattern,
System.Text.RegularExpressions.RegexOptions.Compil ed)
If theRegex.IsMatch(TextBox1.Text) Then
Me.ErrorProvider1.SetError(TextBox1, "")
Else
Me.ErrorProvider1.SetError(TextBox1, "Invalid characters")
e.Cancel = True
End If
End Sub
The following sites provide a wealth of information on regular expressions.
A tutorial & reference on using regular expressions:
http://www.regular-expressions.info/
The MSDN's documentation on regular expressions:
http://msdn.microsoft.com/library/de...geElements.asp
Hope this helps
Jay
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP12.phx.gbl...
Hi group, can the following be done by using a regex, I want a textbox
only
to contain numbers or . / + - ^ , but I've never used a regex before so I
don't know how to go about it. Could I for example check if the typed
character is in a given regex. Maybe this is a stupid question, I don't
now.
grtz Peter