change control tag to be metadata class

This commit is contained in:
Jonathan Jenne 2019-10-17 13:54:26 +02:00
parent 0ec31f0cc3
commit 037b7c6748
4 changed files with 112 additions and 67 deletions

View File

@ -42,6 +42,12 @@ Public Class ClassControlCreator
Public Location As Point Public Location As Point
Public [Font] As Font Public [Font] As Font
Public [Color] As Color Public [Color] As Color
Public [ReadOnly] As Boolean
End Class
Public Class ControlMetadata
Public Guid As Integer
Public [ReadOnly] As Boolean
End Class End Class
Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps Private Shared Function TransformDataRow(row As DataRow) As ControlDBProps
@ -52,25 +58,31 @@ Public Class ClassControlCreator
Dim familyString As String = NotNull(row.Item("FONT_FAMILY"), DEFAULT_FONT_FAMILY) Dim familyString As String = NotNull(row.Item("FONT_FAMILY"), DEFAULT_FONT_FAMILY)
Dim family As FontFamily = New FontFamily(familyString) Dim family As FontFamily = New FontFamily(familyString)
Dim Guid As Integer = row.Item("GUID") Dim oGuid As Integer = row.Item("GUID")
Dim Name As String = row.Item("NAME") Dim oName As String = row.Item("NAME")
Dim Location As New Point(x, y) Dim oLocation As New Point(x, y)
Dim Font As New Font(family, size, style, GraphicsUnit.Point) Dim oFont As New Font(family, size, style, GraphicsUnit.Point)
Dim Color As Color = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR)) Dim oColor As Color = IntToColor(NotNull(row.Item("FONT_COLOR"), DEFAULT_COLOR))
Dim oReadOnly As Boolean = row.Item("READ_ONLY")
Return New ControlDBProps() With { Return New ControlDBProps() With {
.Guid = Guid, .Guid = oGuid,
.Name = Name, .Name = oName,
.Location = Location, .Location = oLocation,
.Font = Font, .Font = oFont,
.Color = Color .Color = oColor,
.ReadOnly = oReadOnly
} }
End Function End Function
Public Shared Function CreateBaseControl(ctrl As Control, row As DataRow, designMode As Boolean) As Control Public Shared Function CreateBaseControl(ctrl As Control, row As DataRow, designMode As Boolean) As Control
Dim props As ControlDBProps = TransformDataRow(row) Dim props As ControlDBProps = TransformDataRow(row)
ctrl.Tag = props.Guid ctrl.Tag = New ControlMetadata() With {
.Guid = props.Guid,
.ReadOnly = props.ReadOnly
}
'ctrl.Tag = props.Guid
ctrl.Name = props.Name ctrl.Name = props.Name
ctrl.Location = props.Location ctrl.Location = props.Location
ctrl.Font = props.Font ctrl.Font = props.Font
@ -80,6 +92,10 @@ Public Class ClassControlCreator
ctrl.Cursor = Cursors.Hand ctrl.Cursor = Cursors.Hand
End If End If
If props.ReadOnly Then
ctrl.BackColor = Color.Gray
End If
Return ctrl Return ctrl
End Function End Function

View File

@ -298,7 +298,11 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, label.Name, "LBL", label.Text, label.Location.X, label.Location.Y, Environment.UserName, label.Size.Height, label.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, label.Name, "LBL", label.Text, label.Location.X, label.Location.Y, Environment.UserName, label.Size.Height, label.Size.Width)
CurrentControl = label CurrentControl = label
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(label) pnldesigner.Controls.Add(label)
@ -309,7 +313,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, txt.Name, "TXT", txt.Name, txt.Location.X, txt.Location.Y, Environment.UserName, txt.Size.Height, txt.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, txt.Name, "TXT", txt.Name, txt.Location.X, txt.Location.Y, Environment.UserName, txt.Size.Height, txt.Size.Width)
CurrentControl = txt CurrentControl = txt
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(txt) pnldesigner.Controls.Add(txt)
@ -320,7 +327,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, cmb.Name, "CMB", cmb.Name, cmb.Location.X, cmb.Location.Y, Environment.UserName, cmb.Size.Height, cmb.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, cmb.Name, "CMB", cmb.Name, cmb.Location.X, cmb.Location.Y, Environment.UserName, cmb.Size.Height, cmb.Size.Width)
CurrentControl = cmb CurrentControl = cmb
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(cmb) pnldesigner.Controls.Add(cmb)
@ -331,7 +341,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, dtp.Name, "DTP", dtp.Name, dtp.Location.X, dtp.Location.Y, Environment.UserName, dtp.Size.Height, dtp.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, dtp.Name, "DTP", dtp.Name, dtp.Location.X, dtp.Location.Y, Environment.UserName, dtp.Size.Height, dtp.Size.Width)
CurrentControl = dtp CurrentControl = dtp
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(dtp) pnldesigner.Controls.Add(dtp)
@ -342,7 +355,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, chk.Name, "CHK", chk.Text, chk.Location.X, chk.Location.Y, Environment.UserName, chk.Size.Height, chk.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, chk.Name, "CHK", chk.Text, chk.Location.X, chk.Location.Y, Environment.UserName, chk.Size.Height, chk.Size.Width)
CurrentControl = chk CurrentControl = chk
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(chk) pnldesigner.Controls.Add(chk)
@ -354,7 +370,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, lc.Name, "LOOKUP", lc.Name, lc.Location.X, lc.Location.Y, Environment.UserName, lc.Size.Height, lc.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, lc.Name, "LOOKUP", lc.Name, lc.Location.X, lc.Location.Y, Environment.UserName, lc.Size.Height, lc.Size.Width)
CurrentControl = lc CurrentControl = lc
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(lc) pnldesigner.Controls.Add(lc)
@ -366,11 +385,16 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, tb.Name, "TABLE", tb.Name, tb.Location.X, tb.Location.Y, Environment.UserName, tb.Size.Height, tb.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, tb.Name, "TABLE", tb.Name, tb.Location.X, tb.Location.Y, Environment.UserName, tb.Size.Height, tb.Size.Width)
CurrentControl = tb Dim oControlId = GetLastID()
CurrentControl.Tag = GetLastID()
TBPM_CONTROL_TABLETableAdapter.Insert(CurrentControl.Tag, "column1", "Column1", 95, Environment.UserName) CurrentControl = tb
TBPM_CONTROL_TABLETableAdapter.Insert(CurrentControl.Tag, "column2", "Column2", 95, Environment.UserName) CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = oControlId,
.ReadOnly = False
}
TBPM_CONTROL_TABLETableAdapter.Insert(oControlId, "column1", "Column1", 95, Environment.UserName)
TBPM_CONTROL_TABLETableAdapter.Insert(oControlId, "column2", "Column2", 95, Environment.UserName)
pnldesigner.Controls.Add(tb) pnldesigner.Controls.Add(tb)
Case ClassControlCreator.PREFIX_LINE Case ClassControlCreator.PREFIX_LINE
@ -381,7 +405,10 @@ Public Class frmFormDesigner
TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, line.Name, "LINE", line.Name, line.Location.X, line.Location.Y, Environment.UserName, line.Size.Height, line.Size.Width) TBPM_PROFILE_CONTROLSTableAdapter.cmdInsertAnlage(ProfileId, line.Name, "LINE", line.Name, line.Location.X, line.Location.Y, Environment.UserName, line.Size.Height, line.Size.Width)
CurrentControl = line CurrentControl = line
CurrentControl.Tag = GetLastID() CurrentControl.Tag = New ClassControlCreator.ControlMetadata() With {
.Guid = GetLastID(),
.ReadOnly = False
}
pnldesigner.Controls.Add(line) pnldesigner.Controls.Add(line)
@ -440,7 +467,7 @@ Public Class frmFormDesigner
Dim oHitinfo As GridHitInfo = oView.CalcHitInfo(sender.PointToClient(Cursor.Position)) Dim oHitinfo As GridHitInfo = oView.CalcHitInfo(sender.PointToClient(Cursor.Position))
CurrentControl = sender CurrentControl = sender
CURRENT_CONTROL_ID = sender.Tag CURRENT_CONTROL_ID = DirectCast(sender.Tag, ClassControlCreator.ControlMetadata).Guid
If oHitinfo.IsValid And oHitinfo.InColumn Then If oHitinfo.IsValid And oHitinfo.InColumn Then
Dim oColumn As GridColumn = oHitinfo.Column Dim oColumn As GridColumn = oHitinfo.Column
@ -717,21 +744,23 @@ Public Class frmFormDesigner
LOGGER.Info(ex) LOGGER.Info(ex)
End Try End Try
Dim oControlId = DirectCast(sender.Tag, ClassControlCreator.ControlMetadata).Guid
row = dt.AsEnumerable().Where(Function(r As DataRow) row = dt.AsEnumerable().Where(Function(r As DataRow)
Return r.Item("GUID") = sender.Tag Return r.Item("GUID") = oControlId
End Function).SingleOrDefault() End Function).SingleOrDefault()
' Control-Id wurde nicht in DataRow gefunden ' Control-Id wurde nicht in DataRow gefunden
If IsNothing(row) Then If IsNothing(row) Then
LOGGER.Info($"Error while filtering Controls by Guid '{sender.Tag}' in LoadControlProperties:") LOGGER.Info($"Error while filtering Controls by Guid '{oControlId}' in LoadControlProperties:")
MsgBox($"Control mit der Id {sender.Tag} wurde nicht gefunden!", MsgBoxStyle.Critical, "Fehler beim Laden der Control Eigenschaften") MsgBox($"Control mit der Id {oControlId} wurde nicht gefunden!", MsgBoxStyle.Critical, "Fehler beim Laden der Control Eigenschaften")
Exit Sub Exit Sub
End If End If
' Globale Variablen setzen ' Globale Variablen setzen
CurrentControl = sender CurrentControl = sender
CURRENT_CONTROL_ID = sender.Tag CURRENT_CONTROL_ID = oControlId
SetActiveControlColor() SetActiveControlColor()

View File

@ -345,7 +345,7 @@ Public Class frmMassValidator
CTRLS_Loaded = True CTRLS_Loaded = True
FillIndexValues() FillIndexValues()
For Each oControl As Control In pnldesigner.Controls For Each oControl As Control In pnldesigner.Controls
LoadSimpleData(oControl, oControl.Tag) LoadSimpleData(oControl, DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid)
Next Next
Catch ex As Exception Catch ex As Exception
LOGGER.Info("Unvorhergesehener Fehler bei Load_Controls:" & ex.Message) LOGGER.Info("Unvorhergesehener Fehler bei Load_Controls:" & ex.Message)
@ -363,7 +363,7 @@ Public Class frmMassValidator
Dim oLOOKUPValue = SelectedValues.Item(0) Dim oLOOKUPValue = SelectedValues.Item(0)
Dim oLOOKUPName = oLookup.Name Dim oLOOKUPName = oLookup.Name
Dim oControlID = oLookup.Tag Dim oControlID = DirectCast(oLookup.Tag, ClassControlCreator.ControlMetadata).Guid
Dim filteredData As DataTable = DTCONTROLS.Clone() Dim filteredData As DataTable = DTCONTROLS.Clone()
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'" Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges) DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
@ -382,7 +382,7 @@ Public Class frmMassValidator
Try Try
Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault() Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
For Each oControl As Control In pnldesigner.Controls For Each oControl As Control In pnldesigner.Controls
If oControl.Tag = oDEPENDING_GUID Then If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
Dim oDependingLookup1 As LookupControl2 = oControl Dim oDependingLookup1 As LookupControl2 = oControl
oDependingLookup1.DataSource = oDTDEPENDING_RESULT oDependingLookup1.DataSource = oDTDEPENDING_RESULT
_dependingControl_in_action = False _dependingControl_in_action = False
@ -411,14 +411,14 @@ Public Class frmMassValidator
Dim resultvalue Dim resultvalue
Try Try
For Each inctrl As Control In Me.pnldesigner.Controls For Each oControl As Control In Me.pnldesigner.Controls
Dim CONTROL_ID = inctrl.Tag Dim CONTROL_ID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid
Dim controlRow = (From form In DTCONTROLS.AsEnumerable' DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable() Dim controlRow = (From form In DTCONTROLS.AsEnumerable' DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable()
Select form Select form
Where form.Item("GUID") = CONTROL_ID).Single() Where form.Item("GUID") = CONTROL_ID).Single()
Dim Type As String = inctrl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Dim Typ As String = controlRow.Item("CTRL_TYPE") Dim Typ As String = controlRow.Item("CTRL_TYPE")
If Typ = "LBL" Or Typ = "LINE" Then If Typ = "LBL" Or Typ = "LINE" Then
Continue For Continue For
@ -428,29 +428,29 @@ Public Class frmMassValidator
Dim defaultValue As String = NotNull(controlRow.Item("DEFAULT_VALUE"), String.Empty) Dim defaultValue As String = NotNull(controlRow.Item("DEFAULT_VALUE"), String.Empty)
indexname = idxname indexname = idxname
Dim LoadIDX As Boolean = controlRow.Item("LOAD_IDX_VALUE") Dim LoadIDX As Boolean = controlRow.Item("LOAD_IDX_VALUE")
LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & inctrl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString) LOGGER.Debug("INDEX: " & idxname & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString)
Dim wertWD Dim wertWD
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "System.Windows.Forms.TextBox"
Try Try
controltype = "Textbox" controltype = "Textbox"
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
End If End If
If idxname Is Nothing = False Then If idxname Is Nothing = False Then
If LoadIDX = False Or idxname = "DD PM-ONLY FOR DISPLAY" Then If LoadIDX = False Or idxname = "DD PM-ONLY FOR DISPLAY" Then
' Wenn kein Index exisitiert, defaultValue laden ' Wenn kein Index exisitiert, defaultValue laden
inctrl.Text = defaultValue oControl.Text = defaultValue
LOGGER.Debug("Indexwert soll nicht geladen werden.") LOGGER.Debug("Indexwert soll nicht geladen werden.")
Exit Select Exit Select
End If End If
wertWD = GetWM_Value_Multiple_Docs(idxname) wertWD = GetWM_Value_Multiple_Docs(idxname)
If wertWD = "" And defaultValue <> "" Then If wertWD = "" And defaultValue <> "" Then
inctrl.Text = defaultValue oControl.Text = defaultValue
Else Else
inctrl.Text = NotNull(wertWD, defaultValue) oControl.Text = NotNull(wertWD, defaultValue)
End If End If
End If End If
@ -467,9 +467,9 @@ Public Class frmMassValidator
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
controltype = "ComboBox" controltype = "ComboBox"
Dim cmb As ComboBox = inctrl Dim cmb As ComboBox = oControl
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
End If End If
If idxname Is Nothing = False Then If idxname Is Nothing = False Then
@ -496,9 +496,9 @@ Public Class frmMassValidator
End If End If
Case "System.Windows.Forms.DataGridView" Case "System.Windows.Forms.DataGridView"
controltype = "DataGridView" controltype = "DataGridView"
Dim dgv As DataGridView = inctrl Dim dgv As DataGridView = oControl
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
End If End If
If idxname Is Nothing = False Then If idxname Is Nothing = False Then
@ -568,12 +568,12 @@ Public Class frmMassValidator
Case "System.Windows.Forms.CheckBox" Case "System.Windows.Forms.CheckBox"
controltype = "CheckBox" controltype = "CheckBox"
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
End If End If
If idxname Is Nothing = False Then If idxname Is Nothing = False Then
Dim chk As CheckBox = inctrl Dim chk As CheckBox = oControl
If LoadIDX = False Then If LoadIDX = False Then
LOGGER.Debug("Indexwert soll nicht geladen werden.") LOGGER.Debug("Indexwert soll nicht geladen werden.")
@ -634,14 +634,14 @@ Public Class frmMassValidator
End If End If
Case "System.Windows.Forms.DateTimePicker" Case "System.Windows.Forms.DateTimePicker"
controltype = "DateTimePicker" controltype = "DateTimePicker"
Dim DTP As DateTimePicker = inctrl Dim DTP As DateTimePicker = oControl
If idxname = "" Then If idxname = "" Then
MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & inctrl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical)
Exit For Exit For
End If End If
Case "DigitalData.Controls.LookupGrid.LookupControl2" Case "DigitalData.Controls.LookupGrid.LookupControl2"
Try Try
Dim oLookup As LookupControl2 = inctrl Dim oLookup As LookupControl2 = oControl
Dim oWindreamValue = GetWM_Value_Multiple_Docs(idxname) Dim oWindreamValue = GetWM_Value_Multiple_Docs(idxname)
If Not IsNothing(oWindreamValue) Then If Not IsNothing(oWindreamValue) Then
@ -1136,24 +1136,24 @@ Public Class frmMassValidator
Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3) Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3)
CTRL_ID = CTRL_ID.Replace("CTRLID", "") CTRL_ID = CTRL_ID.Replace("CTRLID", "")
Dim value_from_control Dim value_from_control
For Each inctrl As Control In Me.pnldesigner.Controls For Each oControl As Control In Me.pnldesigner.Controls
If IsNothing(inctrl.Tag) Then If IsNothing(oControl.Tag) Then
Continue For Continue For
End If End If
If inctrl.Tag = CTRL_ID Then If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
'###### '######
Dim Type As String = inctrl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "System.Windows.Forms.TextBox"
Try Try
value_from_control = inctrl.Text value_from_control = oControl.Text
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
value_from_control = String.Empty value_from_control = String.Empty
End Try End Try
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
Dim cmb As ComboBox = inctrl Dim cmb As ComboBox = oControl
Try Try
value_from_control = cmb.Text value_from_control = cmb.Text
Catch ex As Exception Catch ex As Exception
@ -1161,7 +1161,7 @@ Public Class frmMassValidator
value_from_control = String.Empty value_from_control = String.Empty
End Try End Try
Case "System.Windows.Forms.DateTimePicker" Case "System.Windows.Forms.DateTimePicker"
Dim dtp As DateTimePicker = inctrl Dim dtp As DateTimePicker = oControl
Try Try
value_from_control = dtp.Value.ToString value_from_control = dtp.Value.ToString
Catch ex As Exception Catch ex As Exception
@ -1170,7 +1170,7 @@ Public Class frmMassValidator
End Try End Try
Case "System.Windows.Forms.CheckBox" Case "System.Windows.Forms.CheckBox"
Dim chk As CheckBox = inctrl Dim chk As CheckBox = oControl
Try Try
value_from_control = chk.Checked value_from_control = chk.Checked
Catch ex As Exception Catch ex As Exception

View File

@ -1028,7 +1028,7 @@ Public Class frmValidator
Dim oLOOKUPValue = SelectedValues.Item(0) Dim oLOOKUPValue = SelectedValues.Item(0)
Dim oLOOKUPName = oLookup.Name Dim oLOOKUPName = oLookup.Name
Dim oControlID = oLookup.Tag Dim oControlID = DirectCast(oLookup.Tag, ClassControlCreator.ControlMetadata).Guid
Dim filteredData As DataTable = DTCONTROLS.Clone() Dim filteredData As DataTable = DTCONTROLS.Clone()
Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'" Dim oExpression = $"SQL_UEBERPRUEFUNG like '%#CTRL#{oLOOKUPName}%'"
DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges) DTCONTROLS.Select(oExpression).CopyToDataTable(filteredData, LoadOption.PreserveChanges)
@ -1048,7 +1048,7 @@ Public Class frmValidator
'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault() 'Dim oDependingLookup As LookupControl2 = pnldesigner.Controls.Find(oDEPENDING_CtrlName, False).FirstOrDefault()
For Each oControl As Control In pnldesigner.Controls For Each oControl As Control In pnldesigner.Controls
If oControl.Tag = oDEPENDING_GUID Then If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = oDEPENDING_GUID Then
If oControl.GetType.ToString = "System.Windows.Forms.TextBox" Then If oControl.GetType.ToString = "System.Windows.Forms.TextBox" Then
oControl.Text = oDTDEPENDING_RESULT.Rows(0).Item(0) oControl.Text = oDTDEPENDING_RESULT.Rows(0).Item(0)
Else Else
@ -1580,7 +1580,7 @@ Public Class frmValidator
FillIndexValues(first) FillIndexValues(first)
For Each oControl As Control In pnldesigner.Controls For Each oControl As Control In pnldesigner.Controls
LoadSQLData(oControl, oControl.Tag) LoadSQLData(oControl, DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid)
Next Next
LOGGER.Debug("Indexmaske geladen") LOGGER.Debug("Indexmaske geladen")
@ -2054,7 +2054,7 @@ Public Class frmValidator
If DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.Rows.Count > 0 Then If DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.Rows.Count > 0 Then
Dim oCount As Integer = 0 Dim oCount As Integer = 0
For Each oControl As Control In Me.pnldesigner.Controls For Each oControl As Control In Me.pnldesigner.Controls
Dim oControlId = oControl.Tag Dim oControlId = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid
Dim oControlRow = (From form In DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable() Dim oControlRow = (From form In DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable()
Select form Select form
Where form.Item("GUID") = oControlId).Single() Where form.Item("GUID") = oControlId).Single()
@ -2791,24 +2791,24 @@ Public Class frmValidator
Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3) Dim CTRL_ID = element.Value.Substring(2, element.Value.Length - 3)
CTRL_ID = CTRL_ID.Replace("CTRLID", "") CTRL_ID = CTRL_ID.Replace("CTRLID", "")
Dim value_from_control Dim value_from_control
For Each inctrl As Control In Me.pnldesigner.Controls For Each oControl As Control In Me.pnldesigner.Controls
If IsNothing(inctrl.Tag) Then If IsNothing(DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid) Then
Continue For Continue For
End If End If
If inctrl.Tag = CTRL_ID Then If DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).Guid = CTRL_ID Then
'###### '######
Dim Type As String = inctrl.GetType.ToString Dim Type As String = oControl.GetType.ToString
Select Case Type Select Case Type
Case "System.Windows.Forms.TextBox" Case "System.Windows.Forms.TextBox"
Try Try
value_from_control = inctrl.Text value_from_control = oControl.Text
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
value_from_control = String.Empty value_from_control = String.Empty
End Try End Try
Case "System.Windows.Forms.ComboBox" Case "System.Windows.Forms.ComboBox"
Dim cmb As ComboBox = inctrl Dim cmb As ComboBox = oControl
Try Try
value_from_control = cmb.Text value_from_control = cmb.Text
Catch ex As Exception Catch ex As Exception
@ -2816,7 +2816,7 @@ Public Class frmValidator
value_from_control = String.Empty value_from_control = String.Empty
End Try End Try
Case "System.Windows.Forms.DateTimePicker" Case "System.Windows.Forms.DateTimePicker"
Dim dtp As DateTimePicker = inctrl Dim dtp As DateTimePicker = oControl
Try Try
value_from_control = dtp.Value.ToString value_from_control = dtp.Value.ToString
Catch ex As Exception Catch ex As Exception
@ -2825,7 +2825,7 @@ Public Class frmValidator
End Try End Try
Case "System.Windows.Forms.CheckBox" Case "System.Windows.Forms.CheckBox"
Dim chk As CheckBox = inctrl Dim chk As CheckBox = oControl
Try Try
value_from_control = chk.Checked value_from_control = chk.Checked
Catch ex As Exception Catch ex As Exception