fix SetDependingControlResult. allow new inputs for lookupgrid when EITHER multiselect or sql is checked

This commit is contained in:
Jonathan Jenne 2020-05-19 11:06:08 +02:00
parent c38a96abc9
commit 14384b85c6
3 changed files with 30 additions and 19 deletions

View File

@ -452,24 +452,27 @@ Public Class ClassControls
LOGGER.Warn("Error in SQL Command: {0}", SqlCommand) LOGGER.Warn("Error in SQL Command: {0}", SqlCommand)
End If End If
If TypeOf oFoundControl Is DevExpress.XtraEditors.TextEdit Then Select Case oFoundControl.GetType.Name
If oDatatable.Rows.Count > 0 Then Case GetType(DevExpress.XtraEditors.TextEdit).Name
Dim oFirstRow As DataRow = oDatatable.Rows.Item(0) If oDatatable.Rows.Count > 0 Then
Dim oFirstRow As DataRow = oDatatable.Rows.Item(0)
If oFirstRow.ItemArray.Length > 0 Then If oFirstRow.ItemArray.Length > 0 Then
Dim oValue = oFirstRow.Item(0).ToString() Dim oValue = oFirstRow.Item(0).ToString()
LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, oValue) LOGGER.Debug("Setting Value for TextEdit [{0}]: [{1}]", oFoundControl.Name, oValue)
DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue
End If
End If End If
End If Case GetType(LookupControl2).Name
ElseIf TypeOf oFoundControl Is LookupControl2 Then LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable
DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable Case GetType(ComboBox).Name
ElseIf TypeOf oFoundControl Is ComboBox Then LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE")
LOGGER.Debug("Setting Value for control [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") DirectCast(oFoundControl, ComboBox).DataSource = oDatatable
DirectCast(oFoundControl, ComboBox).DataSource = oDatatable Case Else
End If LOGGER.Debug("Could not set depending control result for [{0}]", oFoundControl.GetType.Name)
End Select
Catch ex As Exception Catch ex As Exception
LOGGER.Error(ex) LOGGER.Error(ex)
End Try End Try

View File

@ -1726,7 +1726,7 @@
<value>NoControl</value> <value>NoControl</value>
</data> </data>
<data name="VKT_PREVENT_MULTIPLE_VALUESCheckbox.Location" type="System.Drawing.Point, System.Drawing"> <data name="VKT_PREVENT_MULTIPLE_VALUESCheckbox.Location" type="System.Drawing.Point, System.Drawing">
<value>527, 150</value> <value>527, 120</value>
</data> </data>
<data name="VKT_PREVENT_MULTIPLE_VALUESCheckbox.Size" type="System.Drawing.Size, System.Drawing"> <data name="VKT_PREVENT_MULTIPLE_VALUESCheckbox.Size" type="System.Drawing.Size, System.Drawing">
<value>167, 24</value> <value>167, 24</value>
@ -1783,7 +1783,7 @@
<value>3</value> <value>3</value>
</data> </data>
<data name="VKT_ADD_ITEMCheckbox.Location" type="System.Drawing.Point, System.Drawing"> <data name="VKT_ADD_ITEMCheckbox.Location" type="System.Drawing.Point, System.Drawing">
<value>527, 120</value> <value>527, 150</value>
</data> </data>
<data name="VKT_ADD_ITEMCheckbox.Size" type="System.Drawing.Size, System.Drawing"> <data name="VKT_ADD_ITEMCheckbox.Size" type="System.Drawing.Size, System.Drawing">
<value>128, 24</value> <value>128, 24</value>

View File

@ -1414,10 +1414,8 @@ Public Class frmAdministration
Private Sub MULTISELECTCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles MULTISELECTCheckBox.CheckedChanged Private Sub MULTISELECTCheckBox_CheckedChanged(sender As Object, e As EventArgs) Handles MULTISELECTCheckBox.CheckedChanged
If MULTISELECTCheckBox.Checked Then If MULTISELECTCheckBox.Checked Then
VKT_ADD_ITEMCheckbox.Enabled = True
VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = True VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = True
Else Else
VKT_ADD_ITEMCheckbox.Enabled = False
VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False
End If End If
End Sub End Sub
@ -1430,6 +1428,14 @@ Public Class frmAdministration
End If End If
End Sub 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 Private Sub TBDD_INDEX_MANBindingSource_CurrentChanged(sender As Object, e As EventArgs) Handles TBDD_INDEX_MANBindingSource.CurrentChanged
If ListBoxControl3.SelectedIndex = -1 Then If ListBoxControl3.SelectedIndex = -1 Then
EnableControls(Panel1, False) EnableControls(Panel1, False)
@ -1451,4 +1457,6 @@ Public Class frmAdministration
VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False VKT_PREVENT_MULTIPLE_VALUESCheckbox.Enabled = False
End If End If
End Sub End Sub
End Class End Class