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)
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

View File

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