From eeadc9ab753e116366c0365a0489d8958ed36cb2 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 13 Feb 2019 11:05:43 +0100 Subject: [PATCH] fix nullvalue error --- .../DD_PM_WINDREAM/DesignTimeBuild/.dtbcache | Bin 218 -> 218 bytes app/DD_PM_WINDREAM/frmValidator.vb | 115 +++++++++--------- 2 files changed, 58 insertions(+), 57 deletions(-) diff --git a/app/.vs/DD_PM_WINDREAM/DesignTimeBuild/.dtbcache b/app/.vs/DD_PM_WINDREAM/DesignTimeBuild/.dtbcache index 715c91bb439b5d68c69962a8f4a3c4d0343f04fc..671ed4a1339e1ed6980c0b51ee8bfb3acd087d30 100644 GIT binary patch delta 51 zcmcb`c#Cm@h-erC1A{Ar6+;Yz7egvT9uTH7cuh2vpBT|3P{2^ckk63Ca7Vr_5QG6f C`wfNw delta 48 zcmcb`c#Cm@h-@4K1A{Ar6+;X|Fhep!215};Dnlki5|Aun@SUhB&+5+L$q+KpwG{vb C=nAp` diff --git a/app/DD_PM_WINDREAM/frmValidator.vb b/app/DD_PM_WINDREAM/frmValidator.vb index fd6ed74..bce77d4 100644 --- a/app/DD_PM_WINDREAM/frmValidator.vb +++ b/app/DD_PM_WINDREAM/frmValidator.vb @@ -1894,42 +1894,41 @@ Public Class frmValidator End Function Sub FillIndexValues() - Dim controltype As String - Dim indexname As String - Dim resultvalue + Dim oControlType As String + Dim oIndexName As String Try If DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.Rows.Count > 0 Then Dim oCount As Integer = 0 For Each oControl As Control In Me.pnldesigner.Controls - Dim CONTROL_ID = oControl.Tag - Dim controlRow = (From form In DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable() - Select form - Where form.Item("GUID") = CONTROL_ID).Single() - - Dim Type As String = oControl.GetType.ToString - Dim Typ As String = controlRow.Item("CTRL_TYPE") - Dim oWMIndexName As String = controlRow.Item("INDEX_NAME") + Dim oControlId = oControl.Tag + Dim oControlRow = (From form In DD_DMSLiteDataSet.VWPM_CONTROL_INDEX.AsEnumerable() + Select form + Where form.Item("GUID") = oControlId).Single() + + Dim oType As String = oControl.GetType.ToString + Dim oTyp As String = oControlRow.Item("CTRL_TYPE") + Dim oWMIndexName As String = oControlRow.Item("INDEX_NAME") ' Wenn kein defaultValue existiert, leeren String setzen - Dim defaultValue As String = NotNull(controlRow.Item("DEFAULT_VALUE"), String.Empty) - indexname = oWMIndexName + Dim oDefaultValue As String = NotNull(oControlRow.Item("DEFAULT_VALUE"), String.Empty) + oIndexName = oWMIndexName - Dim LoadIDX As Boolean = controlRow.Item("LOAD_IDX_VALUE") - If LogErrorsOnly = False Then ClassLogger.Add(" >> INDEX: " & oWMIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & LoadIDX.ToString, False) + Dim oLoadIndex As Boolean = oControlRow.Item("LOAD_IDX_VALUE") + If LogErrorsOnly = False Then ClassLogger.Add(" >> INDEX: " & oWMIndexName & " - CONTROLNAME: " & oControl.Name & " - LOAD IDXVALUES: " & oLoadIndex.ToString, False) _CURRENT_INDEX_ARRAY(oCount, 0) = oWMIndexName - Select Case Type + Select Case oType Case "System.Windows.Forms.TextBox" Try - controltype = "Textbox" + oControlType = "Textbox" If oWMIndexName = "" Then 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 End If If oWMIndexName Is Nothing = False Then - If LoadIDX = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then + If oLoadIndex = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then ' Wenn kein Index exisitiert, defaultValue laden - oControl.Text = defaultValue - _CURRENT_INDEX_ARRAY(oCount, 1) = defaultValue + oControl.Text = oDefaultValue + _CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexwert soll nicht geladen werden.", False) Exit Select End If @@ -1957,8 +1956,8 @@ Public Class frmValidator End If - oControl.Text = NotNull(wertWD, defaultValue) - _CURRENT_INDEX_ARRAY(oCount, 1) = NotNull(wertWD, defaultValue) + oControl.Text = NotNull(wertWD, oDefaultValue) + _CURRENT_INDEX_ARRAY(oCount, 1) = NotNull(wertWD, oDefaultValue) End If Catch ex As Exception @@ -1966,13 +1965,13 @@ Public Class frmValidator My.Settings.Save() frmError.ShowDialog() ClassLogger.Add(">> Unvorhergesehener Fehler bei FillIndexValuesTextBox: " & ex.Message, True) - ClassLogger.Add(">> Controltype: " & controltype, False) - ClassLogger.Add(">> Indexname windream: " & indexname, False) + ClassLogger.Add(">> Controltype: " & oControlType, False) + ClassLogger.Add(">> Indexname windream: " & oIndexName, False) Exit Sub End Try Case "System.Windows.Forms.ComboBox" - controltype = "ComboBox" + oControlType = "ComboBox" Dim cmb As ComboBox = oControl Try If oWMIndexName = "" Then @@ -1980,12 +1979,12 @@ Public Class frmValidator Exit For End If If oWMIndexName Is Nothing = False Then - If LoadIDX = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then - If defaultValue = String.Empty Then + If oLoadIndex = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then + If oDefaultValue = String.Empty Then cmb.SelectedIndex = -1 Else - cmb.Text = defaultValue - _CURRENT_INDEX_ARRAY(oCount, 1) = defaultValue + cmb.Text = oDefaultValue + _CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue End If If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexwert soll nicht geladen werden.", False) Exit Select @@ -1999,13 +1998,13 @@ Public Class frmValidator If wertWD Is Nothing Then If LogErrorsOnly = False Then ClassLogger.Add($" >> Indexwert aus index {oWMIndexName}: Nothing", False) - If defaultValue = String.Empty Then + If oDefaultValue = String.Empty Then If LogErrorsOnly = False Then ClassLogger.Add($" >> Indexwert-defaultValue wurde nicht gefunden", False) cmb.SelectedIndex = -1 Else If LogErrorsOnly = False Then ClassLogger.Add($" >> Indexwert-defaultValue wird geladen", False) - cmb.Text = defaultValue - _CURRENT_INDEX_ARRAY(oCount, 1) = defaultValue + cmb.Text = oDefaultValue + _CURRENT_INDEX_ARRAY(oCount, 1) = oDefaultValue 'cmb.SelectedIndex = cmb.FindStringExact(defaultValue) End If Else @@ -2027,8 +2026,8 @@ Public Class frmValidator End If Catch ex As Exception ClassLogger.Add(">> Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & cmb.Name & "): " & ex.Message, True) - ClassLogger.Add(">> Controltype: " & controltype, False) - ClassLogger.Add(">> Indexname windream: " & indexname, False) + ClassLogger.Add(">> Controltype: " & oControlType, False) + ClassLogger.Add(">> Indexname windream: " & oIndexName, False) errormessage = "Unvorhergesehener Fehler bei FillIndexValues(Combobox: " & cmb.Name & "): " & vbNewLine & ex.Message & vbNewLine & "Check Logfile" My.Settings.Save() frmError.ShowDialog() @@ -2036,14 +2035,14 @@ Public Class frmValidator End Try Case "System.Windows.Forms.DataGridView" - controltype = "DataGridView" + oControlType = "DataGridView" Dim dgv As DataGridView = oControl If oWMIndexName = "" Then 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 End If If oWMIndexName Is Nothing = False Then - If LoadIDX = False Then + If oLoadIndex = False Then If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexwert soll nicht geladen werden.", False) Exit Select End If @@ -2053,10 +2052,10 @@ Public Class frmValidator If wertWD Is Nothing = False Then 'Es wird gegen ein Vektorfeld nachindexiert If wertWD.GetType.ToString.Contains("System.Object") Then - Select Case Typ + Select Case oTyp 'Tabellendarstellung Case "TABLE" - Dim dt As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = " & CONTROL_ID) + Dim dt As DataTable = ClassDatabase.Return_Datatable("SELECT * FROM TBPM_CONTROL_TABLE WHERE CONTROL_ID = " & oControlId) Dim SpaltenWerte As String() If dt.Rows.Count > 1 Then For Each Zeile As Object In wertWD @@ -2108,7 +2107,7 @@ Public Class frmValidator End If Case "System.Windows.Forms.CheckBox" - controltype = "CheckBox" + oControlType = "CheckBox" If oWMIndexName = "" Then 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 @@ -2117,13 +2116,13 @@ Public Class frmValidator Dim chk As CheckBox = oControl - If LoadIDX = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then + If oLoadIndex = False Or oWMIndexName = "DD PM-ONLY FOR DISPLAY" Then If LogErrorsOnly = False Then ClassLogger.Add(" >> Indexwert soll nicht geladen werden.", False) - If defaultValue <> String.Empty Then + If oDefaultValue <> String.Empty Then Dim result = False _CURRENT_INDEX_ARRAY(oCount, 1) = "False" - If Boolean.TryParse(defaultValue, result) Then + If Boolean.TryParse(oDefaultValue, result) Then chk.Checked = result End If @@ -2142,14 +2141,14 @@ Public Class frmValidator End If _CURRENT_INDEX_ARRAY(oCount, 1) = wertWD.ToString If wertWD Is Nothing Then - ClassLogger.Add(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & indexname & "' ist nothing. Check defaultvalue", False) + ClassLogger.Add(">> Zurückgegebener Wert des Wertes für Checkbox mit Indexname '" & oIndexName & "' ist nothing. Check defaultvalue", False) chk.Checked = False Else If wertWD.ToString = "" Then ClassLogger.Add(">> Versuch, default Value zu laden", False) - If defaultValue <> String.Empty Then + If oDefaultValue <> String.Empty Then Dim result = False - If Boolean.TryParse(defaultValue, result) Then + If Boolean.TryParse(oDefaultValue, result) Then ClassLogger.Add(">> defaultValue wurde geladen", False) chk.Checked = result Else @@ -2191,27 +2190,29 @@ Public Class frmValidator End If Case "DigitalData.Controls.LookupGrid.LookupControl" Try - Dim lookup As LookupControl = oControl - Dim wertWD = aktivesDokument.GetVariableValue(oWMIndexName) + Dim oLookup As LookupControl = oControl + Dim oWindreamValue = aktivesDokument.GetVariableValue(oWMIndexName) - If IsNothing(wertWD) Then - lookup.SelectedValues = New List(Of String) - ElseIf wertWD.GetType.ToString.Contains("System.Object") Then + If IsNothing(oWindreamValue) Then + oLookup.SelectedValues = New List(Of String) + _CURRENT_INDEX_ARRAY(oCount, 1) = String.Empty + ElseIf oWindreamValue.GetType.ToString.Contains("System.Object") Then Dim oArrlist As New List(Of String) - For Each oVectorRow As Object In wertWD + For Each oVectorRow As Object In oWindreamValue oArrlist.Add(oVectorRow.ToString) Next - lookup.SelectedValues = oArrlist + oLookup.SelectedValues = oArrlist + _CURRENT_INDEX_ARRAY(oCount, 1) = oWindreamValue.ToString End If - _CURRENT_INDEX_ARRAY(oCount, 1) = wertWD.ToString + Catch ex As Exception - ClassLogger.Add(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) + ClassLogger.Add(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & oIndexName & " - Fehler: " & vbNewLine & ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in Add LookupControl:") End Try Case "System.Windows.Forms.DateTimePicker" - controltype = "DateTimePicker" + oControlType = "DateTimePicker" Dim DTP As DateTimePicker = oControl If oWMIndexName = "" Then MsgBox("Achtung fehlerhafte Konfiguration:" & vbNewLine & "Für das Control " & oControl.Name & " wurde KEIN INDEX hinterlegt!" & vbNewLine & "Bitte prüfen Sie den Formulardesigner!", MsgBoxStyle.Critical) @@ -2278,8 +2279,8 @@ Public Class frmValidator My.Settings.Save() frmError.ShowDialog() ClassLogger.Add(">> Unvorhergesehener Fehler bei FillIndexValues: " & ex.Message, True) - ClassLogger.Add(">> Controltype: " & controltype, False) - ClassLogger.Add(">> Indexname windream: " & indexname, False) + ClassLogger.Add(">> Controltype: " & oControlType, False) + ClassLogger.Add(">> Indexname windream: " & oIndexName, False) End Try