Betragswert prüfen
[Visual Basic] Private Function Check_Betrag() As Boolean
[Visual Basic] Private Function Check_Betrag() As Boolean
If Trim(Me.txtBetrag.Text) = "" Then
Me.txtBetrag.Text = "0.00"
Return True
End If
If Not IsNumeric(Me.txtBetrag.Text) Then
msg.show_standardmessage(600, MsgBoxStyle.Critical)
Return False
End If
Dim i As Integer
i = Me.txtBetrag.Text.IndexOf(".")
If i = -1 Then
Me.txtBetrag.Text = Me.txtBetrag.Text + ".00"
Exit Function
End If
Dim s = Me.txtBetrag.Text.Substring(i + 1)
If Len(s) = 0 Then
Me.txtBetrag.Text = Me.txtBetrag.Text + "00"
Exit Function
End If
If Len(s) = 1 Then
Me.txtBetrag.Text = Me.txtBetrag.Text + "0"
End If
If Len(s) > 2 Then
msg.show_standardmessage(600, MsgBoxStyle.Critical)
Return False
End If
Return True
End Function
Plattformen: Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition