diff --git a/Global_Indexer/ClassControls.vb b/Global_Indexer/ClassControls.vb index 02d9e98..323a5ae 100644 --- a/Global_Indexer/ClassControls.vb +++ b/Global_Indexer/ClassControls.vb @@ -59,71 +59,71 @@ Public Class ClassControls PrepareDependingControl(sender) End Sub - Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False, Optional SQLSuggestion As Boolean = False) As Control - Try - Dim oSql As String = sql_Vorschlag - Dim oConnectionString As String - Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl2 With { - .MultiSelect = Multiselect, - .AllowAddNewValues = AddNewValues, - .PreventDuplicates = PreventDuplicateValues, - .Location = New Point(11, y), - .Size = New Size(300, 27), - .Name = "cmbMulti" & indexname, - .Tag = New ControlMeta() With { - .IndexName = indexname, - .IndexType = DataType - } - } - oControl.Properties.AppearanceFocused.BackColor = Color.FromArgb(255, 214, 49) + 'Public Function AddVorschlag_ComboBox(indexname As String, y As Integer, conid As Integer, sql_Vorschlag As String, Multiselect As Boolean, DataType As String, Optional Vorgabe As String = "", Optional AddNewValues As Boolean = False, Optional PreventDuplicateValues As Boolean = False, Optional SQLSuggestion As Boolean = False) As Control + ' Try + ' Dim oSql As String = sql_Vorschlag + ' Dim oConnectionString As String + ' Dim oControl As New DigitalData.Controls.LookupGrid.LookupControl3 With { + ' .MultiSelect = Multiselect, + ' .AllowAddNewValues = AddNewValues, + ' .PreventDuplicates = PreventDuplicateValues, + ' .Location = New Point(11, y), + ' .Size = New Size(300, 27), + ' .Name = "cmbMulti" & indexname, + ' .Tag = New ControlMeta() With { + ' .IndexName = indexname, + ' .IndexType = DataType + ' } + ' } + ' oControl.Properties.AppearanceFocused.BackColor = Color.FromArgb(255, 214, 49) - If Not String.IsNullOrEmpty(Vorgabe) Then - Dim oDefaultValues As New List(Of String) + ' If Not String.IsNullOrEmpty(Vorgabe) Then + ' Dim oDefaultValues As New List(Of String) - If Vorgabe.Contains(",") Then - oDefaultValues = Vorgabe. - Split(",").ToList(). - Select(Function(item) item.Trim()). - ToList() - Else - oDefaultValues = Vorgabe. - Split(ClassConstants.VECTORSEPARATOR).ToList(). - Select(Function(item) item.Trim()). - ToList() - End If - oControl.SelectedValues = oDefaultValues - End If + ' If Vorgabe.Contains(",") Then + ' oDefaultValues = Vorgabe. + ' Split(",").ToList(). + ' Select(Function(item) item.Trim()). + ' ToList() + ' Else + ' oDefaultValues = Vorgabe. + ' Split(ClassConstants.VECTORSEPARATOR).ToList(). + ' Select(Function(item) item.Trim()). + ' ToList() + ' End If + ' oControl.SelectedValues = oDefaultValues + ' End If - AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged + ' AddHandler oControl.SelectedValuesChanged, AddressOf Lookup_SelectedValuesChanged - oConnectionString = ClassFormFunctions.GetConnectionString(conid) + ' oConnectionString = ClassFormFunctions.GetConnectionString(conid) - If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then - LOGGER.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) + ' If oConnectionString IsNot Nothing And oSql.Length > 0 And SQLSuggestion = True Then + ' LOGGER.Debug("Connection String (redacted): [{0}]", oConnectionString.Substring(0, 30)) - If ClassPatterns.HasComplexPatterns(oSql) Then - LOGGER.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) - Else - oSql = ClassPatterns.ReplaceInternalValues(oSql) - oSql = ClassPatterns.ReplaceUserValues(oSql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) + ' If ClassPatterns.HasComplexPatterns(oSql) Then + ' LOGGER.Debug(" >>sql enthält Platzhalter und wird erst während der Laufzeit gefüllt!", False) + ' Else + ' oSql = ClassPatterns.ReplaceInternalValues(oSql) + ' oSql = ClassPatterns.ReplaceUserValues(oSql, USER_PRENAME, USER_SURNAME, USER_SHORTNAME, USER_LANGUAGE, USER_EMAIL, USER_ID, CURRENT_DOKART_ID) - Dim oDatatable = ClassDatabase.Return_Datatable_Combined(oSql, oConnectionString, False) - oControl.DataSource = oDatatable - End If - Else - LOGGER.Warn("Connection String for control [{0}] is empty!", oControl.Name) - End If + ' Dim oDatatable = ClassDatabase.Return_Datatable_Combined(oSql, oConnectionString, False) + ' oControl.DataSource = oDatatable + ' End If + ' Else + ' LOGGER.Warn("Connection String for control [{0}] is empty!", oControl.Name) + ' End If - Return oControl - Catch ex As Exception - LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) - LOGGER.Error(ex) - MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:") - Return Nothing - End Try - End Function + ' Return oControl + ' Catch ex As Exception + ' LOGGER.Info(" - Unvorhergesehener Unexpected error in AddVorschlag_ComboBox - Indexname: " & indexname & " - Fehler: " & vbNewLine & ex.Message) + ' LOGGER.Error(ex) + ' MsgBox(ex.Message, MsgBoxStyle.Critical, "Unvorhergesehener Unexpected error in AddVorschlag_ComboBox:") + ' Return Nothing + ' End Try + 'End Function - Private Sub Lookup_SelectedValuesChanged(sender As LookupControl2, SelectedValues As List(Of String)) + Private Sub Lookup_SelectedValuesChanged(sender As LookupControl3, SelectedValues As List(Of String)) PrepareDependingControl(sender) End Sub @@ -474,9 +474,9 @@ Public Class ClassControls DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue End If End If - Case GetType(LookupControl2).Name + Case GetType(LookupControl3).Name LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable + DirectCast(oFoundControl, LookupControl3).Properties.DataSource = oDatatable Case GetType(ComboBox).Name LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") DirectCast(oFoundControl, ComboBox).DataSource = oDatatable diff --git a/Global_Indexer/ClassPatterns.vb b/Global_Indexer/ClassPatterns.vb index 9afc396..877a986 100644 --- a/Global_Indexer/ClassPatterns.vb +++ b/Global_Indexer/ClassPatterns.vb @@ -1,6 +1,7 @@ Imports System.Text.RegularExpressions Imports DevExpress.XtraEditors Imports DigitalData.Controls.LookupGrid +Imports DigitalData.GUIs.GlobalIndexer Imports WINDREAMLib ''' @@ -184,7 +185,7 @@ Public Class ClassPatterns Continue For End If - Dim oMeta = TryCast(oControl.Tag, ClassControls.ControlMeta) + Dim oMeta = TryCast(oControl.Tag, ControlCreator.ControlMeta) LOGGER.Debug("Metadata IndexName: [{0}]", oMeta.IndexName) LOGGER.Debug("Metadata IndexType: [{0}]", oMeta.IndexType) @@ -223,26 +224,26 @@ Public Class ClassPatterns LOGGER.Error(ex) LOGGER.Warn("Control Value for CheckBox [{0}] could not be retrieved!", oFoundControl.Name) End Try - ElseIf TypeOf oFoundControl Is LookupControl2 Then + ElseIf TypeOf oFoundControl Is LookupControl3 Then Try - Dim oLookupControl = DirectCast(oFoundControl, LookupControl2) + Dim oLookupControl = DirectCast(oFoundControl, LookupControl3) - If oLookupControl.MultiSelect Then + If oLookupControl.Properties.MultiSelect Then Select Case oFoundType Case "INTEGER" - oValue = String.Join(",", oLookupControl.SelectedValues) + oValue = String.Join(",", oLookupControl.Properties.SelectedValues) Case "VARCHAR" - Dim oWrapped = oLookupControl.SelectedValues + Dim oWrapped = oLookupControl.Properties.SelectedValues oValue = String.Join(",", oWrapped) Case Else LOGGER.Warn("Lookup Control with [{0}] is not supported!", oFoundType) End Select Else - oValue = NotNull(oLookupControl.SelectedValues.Item(0), "") + oValue = NotNull(oLookupControl.Properties.SelectedValues.Item(0), "") End If Catch ex As Exception LOGGER.Error(ex) - LOGGER.Warn("Control Value for LookupControl2 [{0}] could not be retrieved!", oFoundControl.Name) + LOGGER.Warn("Control Value for LookupControl3 [{0}] could not be retrieved!", oFoundControl.Name) End Try Else LOGGER.Debug("Unknown Control type for type [{0}], setting value to empty string.", oFoundControl.Name) diff --git a/Global_Indexer/frmIndex.designer.vb b/Global_Indexer/frmIndex.designer.vb index ec62da5..b8d9302 100644 --- a/Global_Indexer/frmIndex.designer.vb +++ b/Global_Indexer/frmIndex.designer.vb @@ -31,7 +31,7 @@ Partial Class frmIndex Dim SerializableAppearanceObject4 As DevExpress.Utils.SerializableAppearanceObject = New DevExpress.Utils.SerializableAppearanceObject() Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() Me.pnlIndex = New System.Windows.Forms.Panel() - Me.ComboBoxEdit1 = New DevExpress.XtraEditors.ComboBoxEdit() + Me.ComboboxDoctype = New DevExpress.XtraEditors.ComboBoxEdit() Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() Me.BarToggleSwitchItem1 = New DevExpress.XtraBars.BarToggleSwitchItem() Me.BarToggleSwitchItem2 = New DevExpress.XtraBars.BarToggleSwitchItem() @@ -68,7 +68,7 @@ Partial Class frmIndex Me.SplitContainer1.Panel1.SuspendLayout() Me.SplitContainer1.Panel2.SuspendLayout() Me.SplitContainer1.SuspendLayout() - CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.ComboboxDoctype.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel2.SuspendLayout() CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).BeginInit() @@ -87,7 +87,7 @@ Partial Class frmIndex 'SplitContainer1.Panel1 ' Me.SplitContainer1.Panel1.Controls.Add(Me.pnlIndex) - Me.SplitContainer1.Panel1.Controls.Add(Me.ComboBoxEdit1) + Me.SplitContainer1.Panel1.Controls.Add(Me.ComboboxDoctype) Me.SplitContainer1.Panel1.Controls.Add(Me.Panel2) ' 'SplitContainer1.Panel2 @@ -100,17 +100,17 @@ Partial Class frmIndex Me.pnlIndex.BackColor = System.Drawing.SystemColors.ControlLight Me.pnlIndex.Name = "pnlIndex" ' - 'ComboBoxEdit1 + 'ComboboxDoctype ' - resources.ApplyResources(Me.ComboBoxEdit1, "ComboBoxEdit1") - Me.ComboBoxEdit1.MenuManager = Me.RibbonControl1 - Me.ComboBoxEdit1.Name = "ComboBoxEdit1" + resources.ApplyResources(Me.ComboboxDoctype, "ComboboxDoctype") + Me.ComboboxDoctype.MenuManager = Me.RibbonControl1 + Me.ComboboxDoctype.Name = "ComboboxDoctype" SerializableAppearanceObject1.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(214, Byte), Integer), CType(CType(49, Byte), Integer)) SerializableAppearanceObject1.Options.UseBackColor = True - Me.ComboBoxEdit1.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) - Me.ComboBoxEdit1.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat - Me.ComboBoxEdit1.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText") - Me.ComboBoxEdit1.Properties.Padding = New System.Windows.Forms.Padding(5) + Me.ComboboxDoctype.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons"), DevExpress.XtraEditors.Controls.ButtonPredefines), resources.GetString("ComboBoxEdit1.Properties.Buttons1"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons2"), Integer), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons3"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons4"), Boolean), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons5"), Boolean), EditorButtonImageOptions1, New DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), SerializableAppearanceObject1, SerializableAppearanceObject2, SerializableAppearanceObject3, SerializableAppearanceObject4, resources.GetString("ComboBoxEdit1.Properties.Buttons6"), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons7"), Object), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons8"), DevExpress.Utils.SuperToolTip), CType(resources.GetObject("ComboBoxEdit1.Properties.Buttons9"), DevExpress.Utils.ToolTipAnchor))}) + Me.ComboboxDoctype.Properties.ButtonsStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat + Me.ComboboxDoctype.Properties.NullText = resources.GetString("ComboBoxEdit1.Properties.NullText") + Me.ComboboxDoctype.Properties.Padding = New System.Windows.Forms.Padding(5) ' 'RibbonControl1 ' @@ -349,7 +349,7 @@ Partial Class frmIndex Me.SplitContainer1.Panel2.ResumeLayout(False) CType(Me.SplitContainer1, System.ComponentModel.ISupportInitialize).EndInit() Me.SplitContainer1.ResumeLayout(False) - CType(Me.ComboBoxEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.ComboboxDoctype.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).EndInit() Me.Panel2.ResumeLayout(False) CType(Me.checkMultiindex.Properties, System.ComponentModel.ISupportInitialize).EndInit() @@ -403,5 +403,5 @@ Partial Class frmIndex Friend WithEvents btnOK As DevExpress.XtraEditors.SimpleButton Friend WithEvents checkMultiindex As DevExpress.XtraEditors.CheckEdit Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem - Friend WithEvents ComboBoxEdit1 As DevExpress.XtraEditors.ComboBoxEdit + Friend WithEvents ComboboxDoctype As DevExpress.XtraEditors.ComboBoxEdit End Class diff --git a/Global_Indexer/frmIndex.resx b/Global_Indexer/frmIndex.resx index 0eb2474..956b782 100644 --- a/Global_Indexer/frmIndex.resx +++ b/Global_Indexer/frmIndex.resx @@ -156,10 +156,10 @@ 0 - + Top - + 0, 0 @@ -466,22 +466,22 @@ Bitte wählen Sie ein Profil - + 636, 30 - + 3 - - ComboBoxEdit1 + + ComboboxDoctype - + DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a - + SplitContainer1.Panel1 - + 1 diff --git a/Global_Indexer/frmIndex.vb b/Global_Indexer/frmIndex.vb index d305f7b..c5e9de1 100644 --- a/Global_Indexer/frmIndex.vb +++ b/Global_Indexer/frmIndex.vb @@ -7,6 +7,7 @@ Imports System.Security.Principal Imports System.DirectoryServices Imports DigitalData.Modules.Logging Imports DigitalData.Controls.LookupGrid +Imports DigitalData.GUIs.GlobalIndexer Public Class frmIndex #Region "+++++ Variablen ++++++" @@ -355,8 +356,8 @@ Public Class frmIndex End If If oControl.Name.StartsWith("cmbMulti") Then - Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl2) - Dim values As List(Of String) = oLookup.SelectedValues + Dim oLookup = DirectCast(oControl, DigitalData.Controls.LookupGrid.LookupControl3) + Dim values As List(Of String) = oLookup.Properties.SelectedValues If values.Count = 0 Then Dim optional_index As Boolean = ClassDatabase.Execute_Scalar("SELECT OPTIONAL FROM TBDD_INDEX_MAN WHERE DOK_ID = " & dokartid & " AND NAME = '" & Replace(oLookup.Name, "cmbMulti", "") & "'", MyConnectionString, True) @@ -1569,13 +1570,13 @@ Public Class frmIndex checkItemPreselection.Checked = True If CURRENT_LASTDOKART <> "" Then - Dim oFoundDocType = ComboBoxEdit1.Properties.Items. + Dim oFoundDocType = ComboboxDoctype.Properties.Items. Cast(Of DocType)(). Where(Function(dt) dt.Name = CURRENT_LASTDOKART). FirstOrDefault() If oFoundDocType IsNot Nothing Then - ComboBoxEdit1.SelectedItem = oFoundDocType + ComboboxDoctype.SelectedItem = oFoundDocType End If 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART) @@ -1590,13 +1591,13 @@ Public Class frmIndex _Logger.Debug("Regex: [{0}], FileName: [{1}]", oRoW.Item("Regex"), oOnlyFilename) 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(oRoW.Item("DOCTYPE")) - Dim oFoundDocType = ComboBoxEdit1.Properties.Items. + Dim oFoundDocType = ComboboxDoctype.Properties.Items. Cast(Of DocType)(). Where(Function(dt) dt.Name = CURRENT_LASTDOKART). FirstOrDefault() If oFoundDocType IsNot Nothing Then - ComboBoxEdit1.SelectedItem = oFoundDocType + ComboboxDoctype.SelectedItem = oFoundDocType End If Exit For @@ -1620,20 +1621,26 @@ Public Class frmIndex 'cmbDokumentart.AutoCompleteSource = AutoCompleteSource.ListItems 'cmbDokumentart.SelectedIndex = -1 + ComboboxDoctype.Properties.Items.Clear() + + + For Each oRow As DataRow In oDoctypes.Rows - ComboBoxEdit1.Properties.Items.Add(New DocType With { + ComboboxDoctype.Properties.Items.Add(New DocType With { .Guid = oRow.Item("DOCTYPE_ID"), .Name = oRow.Item("DOCTYPE") }) Next + + ComboboxDoctype.SelectedIndex = -1 Catch ex As Exception ShowErrorMessage(ex, "Refresh_Dokart") End Try End Sub - Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxEdit1.SelectedIndexChanged - If ComboBoxEdit1.SelectedIndex <> -1 And FormLoaded = True Then - Dim oSelectedItem As DocType = ComboBoxEdit1.SelectedItem + Private Sub ComboBoxEdit1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboboxDoctype.SelectedIndexChanged + If ComboboxDoctype.SelectedIndex <> -1 And FormLoaded = True Then + Dim oSelectedItem As DocType = ComboboxDoctype.SelectedItem CURRENT_DOKART_ID = oSelectedItem.Guid @@ -1728,8 +1735,8 @@ Public Class frmIndex ' ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") '_Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & cmbDokumentart.Text & " definiert") - ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") - _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboBoxEdit1.Text & " definiert") + ShowError("Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.Text & " definiert") + _Logger.Info(" - Keine Manuellen Indizes für die " & vbNewLine & "Dokumentart " & ComboboxDoctype.Text & " definiert") End If For Each oRow As DataRow In DT_INDEXEMAN.Rows @@ -1823,7 +1830,7 @@ Public Class frmIndex End Try End Sub - Private Function GetLookupData(pLookup As LookupControl2, pSQLCommand As String, pConnectionId As Integer) + Private Function GetLookupData(pLookup As LookupControl3, pSQLCommand As String, pConnectionId As Integer) Dim oConnectionString = ClassFormFunctions.GetConnectionString(pConnectionId) If oConnectionString IsNot Nothing And pSQLCommand.Length > 0 Then @@ -1851,7 +1858,7 @@ Public Class frmIndex End If Try - Dim oMeta = DirectCast(Control.Tag, ClassControls.ControlMeta) + Dim oMeta = DirectCast(Control.Tag, ControlCreator.ControlMeta) Dim oIndexName As String = oMeta.IndexName Dim oSQL = $"SELECT * FROM TBDD_INDEX_MAN WHERE SQL_RESULT LIKE '%{oIndexName}%'" Dim oDatatable As DataTable = ClassDatabase.Return_Datatable(oSQL) @@ -1897,7 +1904,7 @@ Public Class frmIndex Continue For End If - Dim oMeta = DirectCast(oControl.Tag, ClassControls.ControlMeta) + Dim oMeta = DirectCast(oControl.Tag, ControlCreator.ControlMeta) Dim oIndex As String = oMeta.IndexName If oIndex = IndexName Then @@ -1908,10 +1915,12 @@ Public Class frmIndex If oFoundControl Is Nothing Then LOGGER.Warn("Depending Control for Index [{0}] not found!", IndexName) + Exit Sub End If If oDatatable Is Nothing Then LOGGER.Warn("Error in SQL Command: {0}", SqlCommand) + Exit Sub End If Select Case oFoundControl.GetType.Name @@ -1926,9 +1935,15 @@ Public Class frmIndex DirectCast(oFoundControl, DevExpress.XtraEditors.TextEdit).Text = oValue End If End If - Case GetType(LookupControl2).Name + Case GetType(LookupControl3).Name LOGGER.Debug("Setting Value for LookupControl [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") - DirectCast(oFoundControl, LookupControl2).DataSource = oDatatable + Dim oLookupControl = DirectCast(oFoundControl, LookupControl3) + oLookupControl.Properties.DataSource = oDatatable + + If oDatatable.Columns.Count > 0 Then + oLookupControl.Properties.ValueMember = oDatatable.Columns.Item(0).ColumnName + oLookupControl.Properties.DisplayMember = oDatatable.Columns.Item(0).ColumnName + End If Case GetType(ComboBox).Name LOGGER.Debug("Setting Value for Combobox [{0}]: [{1}]", oFoundControl.Name, "DATATABLE") DirectCast(oFoundControl, ComboBox).DataSource = oDatatable @@ -2146,7 +2161,7 @@ Public Class frmIndex _Logger.Debug("Manuelle Indexe geladen") If MyDataset.VWDDINDEX_MAN.Rows.Count > 0 Then - Dim oDokart As DocType = ComboBoxEdit1.SelectedItem + Dim oDokart As DocType = ComboboxDoctype.SelectedItem CURRENT_DOKART_ID = oDokart.Guid If CheckWrite_IndexeMan(oDokart.Guid) = True Then