Try to fix error with profil combobox

This commit is contained in:
Jonathan Jenne
2022-01-25 14:29:24 +01:00
parent 3bf845100e
commit 59380fa964

View File

@@ -1663,12 +1663,14 @@ Public Class frmIndex
FormLoaded = True FormLoaded = True
Try Try
_Logger.Info("Profile Preselected enabled: {0}", CONFIG.Config.ProfilePreselection)
' Letzte Auswahl merken überschreibt die automatische selektion ' Letzte Auswahl merken überschreibt die automatische selektion
If CONFIG.Config.ProfilePreselection Then If CONFIG.Config.ProfilePreselection Then
checkItemPreselection.Checked = True checkItemPreselection.Checked = True
If CURRENT_LASTDOKART <> "" Then If CURRENT_LASTDOKART <> "" Then
_Logger.Info("Last Saved DocType: {0}", CURRENT_LASTDOKART)
Dim oFoundDocType = ComboboxDoctype.Properties.DataSource. Dim oFoundDocType = ComboboxDoctype.Properties.DataSource.
Cast(Of DocType)(). Cast(Of DocType)().
@@ -1676,14 +1678,19 @@ Public Class frmIndex
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
_Logger.Info("Setting Last Saved DocType: {0}", CURRENT_LASTDOKART)
ComboboxDoctype.EditValue = oFoundDocType ComboboxDoctype.EditValue = oFoundDocType
End If End If
'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART) 'cmbDokumentart.SelectedIndex = cmbDokumentart.FindStringExact(CURRENT_LASTDOKART)
End If End If
End If End If
If ComboboxDoctype.EditValue Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0 Then Dim oApplyRegex = ComboboxDoctype.EditValue Is Nothing And DTTBGI_REGEX_DOCTYPE.Rows.Count > 0
_Logger.Info("Applying Profile Selection Regex: [{0}]", oApplyRegex)
If oApplyRegex Then
For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows For Each oRoW As DataRow In DTTBGI_REGEX_DOCTYPE.Rows
Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE) Dim oOnlyFilename = Path.GetFileName(CURRENT_WORKFILE)
If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then If Regex.IsMatch(oOnlyFilename, oRoW.Item("Regex")) Then
@@ -1698,11 +1705,14 @@ Public Class frmIndex
FirstOrDefault() FirstOrDefault()
If oFoundDocType IsNot Nothing Then If oFoundDocType IsNot Nothing Then
_Logger.Debug("DocType found: [{0}]", oFoundDocType)
ComboboxDoctype.EditValue = oFoundDocType ComboboxDoctype.EditValue = oFoundDocType
Exit For Exit For
End If End If
End If End If
Next Next
Else
ComboboxDoctype.EditValue = Nothing
End If End If
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex, "Form Shown") ShowErrorMessage(ex, "Form Shown")