15.06 JJ für MS

This commit is contained in:
SchreiberM
2016-06-15 11:07:47 +02:00
parent 621a7f0fff
commit 6a708d29e4
10 changed files with 325 additions and 551 deletions

View File

@@ -1,4 +1,5 @@
Imports System.Windows.Forms
Imports System.Text.RegularExpressions
Public Class ClassControlBuilder
Private _master_panel As Panel
@@ -217,13 +218,14 @@ Public Class ClassControlBuilder
If LogErrorsOnly = False Then ClassLogger.Add(" >> " & String.Format("Executing SQL_COMMAND: '{0}' for controlID '{1}'", sqlcommand, dependingControlId), False)
' Jetzt wird das SQL Command ausgeführt, es MUSS einen Boolschen Wert zurückgeben, True, False, 0, 1
Dim dt As DataTable = ClassDatabase.Return_Datatable(sqlcommand)
Dim dt_result As DataTable = Nothing
dt_result = ClassDatabase.Return_Datatable(sqlcommand)
If dt.Rows.Count = 1 Then
Dim enabled As Boolean = CBool(dt.Rows(0).Item(0))
If dt_result.Rows.Count = 1 Then
Dim enabled As Boolean = CBool(dt_result.Rows(0).Item(0))
dependingControl.Enabled = enabled
Else
ClassLogger.Add(" >> Attention: RowCount for enabling control was '" & dt.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'")
ClassLogger.Add(" >> Attention: RowCount for enabling control (" & dependingControlId.ToString & ") was '" & dt_result.Rows.Count.ToString & "' and not 1 as expected - Check SQL: '" & sqlcommand & "'", False)
End If
End If
@@ -979,16 +981,42 @@ Public Class ClassControlBuilder
End If
AddHandler control.KeyUp, AddressOf AutoCompleteCombo_KeyUp
End Sub
Public Function IsValidCurrency(currencyValue As String) As Boolean
Dim pattern As String = "\p{Sc}+\s*\d+"
Dim currencyRegex As New Regex(pattern)
Return currencyRegex.IsMatch(currencyValue)
End Function
Private Sub Textbox_Currency_Handler(sender As Object, e As EventArgs)
Dim control As TextBox = DirectCast(sender, TextBox)
Dim value As Decimal
Dim currencyRegex = New System.Text.RegularExpressions.Regex("[0-9,\.]*")
Dim match = currencyRegex.Match(control.Text)
If Not match.Success Then
hier currency prüfen
If control.Text <> "" Then
Dim controlvalue = control.Text
If controlvalue.Contains(".") Then
controlvalue = controlvalue.Replace(".", ",")
End If
Dim value As Double
If Double.TryParse(controlvalue, Globalization.NumberStyles.Currency, Nothing, value) Then
'Valid.
control.Text = value.ToString("c"c)
Else
'Invalid.
MessageBox.Show("Please enter a valid curreny amount.")
control.Focus()
control.SelectAll()
End If
End If
'Dim i = IsValidCurrency(control.Text)
'If IsValidCurrency(control.Text) = False Then
' MsgBox("Sorry but some input characters are invalid for the format currency!", MsgBoxStyle.Exclamation)
' control.Focus()
' control.SelectAll()
'End If
'Dim currencyRegex = New System.Text.RegularExpressions.Regex("[0-9,\.]*")
'Dim match = currencyRegex.Match(control.Text)
'If match.Success Then
'End If