From 14384b85c69cb2b2dd5bc3e75e18501b53d6fc8a Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Tue, 19 May 2020 11:06:08 +0200 Subject: [PATCH] fix SetDependingControlResult. allow new inputs for lookupgrid when EITHER multiselect or sql is checked --- Global_Indexer/ClassControls.vb | 33 +++++++++++++++------------ Global_Indexer/frmAdministration.resx | 4 ++-- Global_Indexer/frmAdministration.vb | 12 ++++++++-- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Global_Indexer/ClassControls.vb b/Global_Indexer/ClassControls.vb index d86b8fc..0e847ed 100644 --- a/Global_Indexer/ClassControls.vb +++ b/Global_Indexer/ClassControls.vb @@ -452,24 +452,27 @@ Public Class ClassControls LOGGER.Warn("Error in SQL Command: {0}", SqlCommand) End If - If TypeOf oFoundControl Is DevExpress.XtraEditors.TextEdit Then - If oDatatable.Rows.Count > 0 Then - Dim oFirstRow As DataRow = oDatatable.Rows.Item(0) + Select Case oFoundControl.GetType.Name + Case GetType(DevExpress.XtraEditors.TextEdit).Name + If oDatatable.Rows.Count > 0 Then + Dim oFirstRow As DataRow = oDatatable.Rows.Item(0) - If oFirstRow.ItemArray.Length > 0 Then - Dim oValue = oFirstRow.Item(0).ToString() + If oFirstRow.ItemArray.Length > 0 Then + Dim oValue = oFirstRow.Item(0).ToString() - LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, oValue) - DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue + LOGGER.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue) + DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue + End If End If - End If - ElseIf TypeOf oFoundControl Is LookupControl2 Then - LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable - ElseIf TypeOf oFoundControl Is ComboBox Then - LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - DirectCast(oFoundControl, ComboBox).DataSource = oDatatable - End If + Case GetType(LookupControl2).Name + LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") + DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable + Case GetType(ComboBox).Name + LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") + DirectCast(oFoundControl, ComboBox).DataSource = oDatatable + Case Else + LOGGER.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name) + End Select Catch ex As Exception LOGGER.Error(ex) End Try diff --git a/Global_Indexer/frmAdministration.resx b/Global_Indexer/frmAdministration.resx index 9266d05..e74b529 100644 --- a/Global_Indexer/frmAdministration.resx +++ b/Global_Indexer/frmAdministration.resx @@ -1726,7 +1726,7 @@ NoControl - 527, 150 + 527, 120 167, 24 @@ -1783,7 +1783,7 @@ 3 - 527, 120 + 527, 150 128, 24 diff --git a/Global_Indexer/frmAdministration.vb b/Global_Indexer/frmAdministration.vb index 1e0a444..5605783 100644 --- a/Global_Indexer/frmAdministration.vb +++ b/Global_Indexer/frmAdministration.vb @@ -1414,10 +1414,8 @@ Public Class frmAdministration Private Sub MULTISELECTCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles MULTISELECTCheckBox.CheckedChanged If MULTISELECTCheckBox.Checked Then - VKT_ADD_ITEMCheckbox.Enabled = True VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = True Else - VKT_ADD_ITEMCheckbox.Enabled = False VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False End If End Sub @@ -1430,6 +1428,14 @@ Public Class frmAdministration End If End Sub + Private Sub SUGGESTIONCheckBoxMULTISELECTCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles SUGGESTIONCheckBox.CheckedChanged, MULTISELECTCheckBox.CheckedChanged + If SUGGESTIONCheckBox.Checked Or MULTISELECTCheckBox.Checked Then + VKT_ADD_ITEMCheckbox.Enabled = True + Else + VKT_ADD_ITEMCheckbox.Enabled = False + End If + End Sub + Private Sub TBDD_INDEX_MANBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBDD_INDEX_MANBindingSource.CurrentChanged If ListBoxControl3.SelectedIndex = -1 Then EnableControls(Panel1, False) @@ -1451,4 +1457,6 @@ Public Class frmAdministration VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False End If End Sub + + End Class