"YardDancer" <da*********@hotmail.comschrieb:
I don't want to use the the Cint() or CDec() or other VB.Net Functions
and I dont want to restrict keystrokes in the textbox.
\\\
Private Sub TextBox1_Validating( _
ByVal sender As Object, _
ByVal e As CancelEventArgs _
) Handles TextBox1.Validating
Dim SourceControl As TextBox = DirectCast(sender, TextBox)
Dim n As Integer
If Not Integer.TryParse(SourceControl.Text, n) Then
Me.ErrorProvider1.SetError( _
SourceControl, _
"Value must be an integer." _
)
Else
If Me.ErrorProvider1.GetError(SourceControl).Length 0 Then
Me.ErrorProvider1.SetError(SourceControl, "")
End If
...
End If
End Sub
///
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>