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