Public Sub dwTextBox_KeyUp(ByVal sender As Object, ByVal e As System.EventArgs)
Dim nowTag As TagDefaultItems = sender.Tag
Dim updateStatusText As Boolean = False
addOrChangeDictionary(nowTag.RefDicText, sender, "")
Dim didChange As Boolean = (sender.Text = DirectCast(sender.Tag, TagDefaultItems).DefaultVal)
SetChangedColor(sender, Not didChange)
If Not IsNothing(nowTag.RefDicChanged) Then
Try
nowTag.RefDicChanged(sender) = didChange
Catch ex As Exception
End Try
End If
If Not IsNothing(nowTag.RefDicValid) Then
nowTag.RefDicValid(sender) = True
If nowTag.Type = FIELD_TYPE_DATUM Or nowTag.Type = FIELD_TYPE_DATUM_NOT_EMPTY Then
Dim tempDate As Object = dwParseDate(sender)
If IsNothing(tempDate) Then
sender.BackColor = backERROR
addOrChangeDictionary(nowTag.RefDicText, sender, "Datum nicht lesbar, bitte geben Sie ein gültiges Datum ein!")
updateStatusText = True
If nowTag.Type = FIELD_TYPE_DATUM_NOT_EMPTY Then
nowTag.RefDicValid(sender) = False
End If
Else
sender.BackColor = backOK
End If
If nowTag.Type = FIELD_TYPE_DATUM And sender.ToString.Trim = "" Then
sender.BackColor = backOK
End If
ElseIf nowTag.Type = FIELD_TYPE_TEXT_NOT_EMPTY Then
If sender.text.ToString.Trim.Length <= nowTag.DezimalStellen Then
nowTag.RefDicValid(sender) = False
sender.BackColor = backERROR
addOrChangeDictionary(nowTag.RefDicText, sender, "Text zu kurz" & If(nowTag.DezimalStellen > 0, "minimal " & (nowTag.DezimalStellen).ToString & " Zeichen)!", ""))
updateStatusText = True
Else
sender.BackColor = backOK
End If
End If
End If
If Not IsNothing(nowTag.RefHandler) And updateStatusText Then
nowTag.RefHandler.Invoke(sender, New dwRefHandlerEventArgs(True))
End If
End Sub
Public Sub dwCheckBox_CheckedChanged(ByVal sender As CheckBox, ByVal e As System.EventArgs)
If sender.Checked = DirectCast(sender.Tag, TagDefaultItems).DefaultVal Then
sender.ForeColor = Color.Black
Else
sender.ForeColor = Color.DarkRed
End If
End Sub
Public Sub dwTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs)
Dim i As Integer = Asc(e.KeyChar)
Dim nowTag As TagDefaultItems = sender.Tag
If Asc(e.KeyChar) = 39
Then ' verhindern
e.Handled = True
End If
If nowTag.Uppercase Then
e.KeyChar = e.KeyChar.ToString.ToUpper
End If
If nowTag.Numeric Or nowTag.Type = FIELD_TYPE_NUMERIC Or nowTag.Type = FIELD_TYPE_NUMERIC_WITH_lEADING_ZERO Or nowTag.Type = FIELD_TYPE_NUMERIC_WITHOUT_DOT Or nowTag.Type = FIELD_TYPE_NUMERIC_WITHOUT_DOT_WITH_lEADING_ZERO Then
Dim numberFormatInfo As Globalization.NumberFormatInfo = System.Globalization.CultureInfo.CurrentCulture.NumberFormat
Dim isDecimalSeparator As String = numberFormatInfo.NumberDecimalSeparator
Dim isGroupSeparator As String = numberFormatInfo.NumberGroupSeparator
Dim isNegativeSign As String = numberFormatInfo.NegativeSign
Dim keyInput As String = e.KeyChar.ToString()
If [Char].IsDigit(e.KeyChar) Then
ElseIf keyInput.Equals(isDecimalSeparator) Or keyInput.Equals(isGroupSeparator) Or keyInput.Equals(isNegativeSign) Then
' decimalSeparator ist erlaubt
ElseIf e.KeyChar = vbBack Then
Else
e.Handled = True
End If
End If
End Sub