From a90bf67575fab863890b919f9d53ebf9ff0adf84 Mon Sep 17 00:00:00 2001 From: OlgunR Date: Mon, 16 Mar 2026 11:17:16 +0100 Subject: [PATCH] Refactor btnLink enabling logic by profile type EnableBtnLink() now enables/disables btnLink based on the selected profile's type, applying specific logic for "db", "activedirectory", "xml", and "fulltext". The method is also called after regex and XML tree changes to keep the button state in sync with the UI. --- ToolCollection/frmNIVerknuepfungen.vb | 31 ++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/ToolCollection/frmNIVerknuepfungen.vb b/ToolCollection/frmNIVerknuepfungen.vb index 6844fc9..2577ffc 100644 --- a/ToolCollection/frmNIVerknuepfungen.vb +++ b/ToolCollection/frmNIVerknuepfungen.vb @@ -1396,9 +1396,30 @@ Public Class frmNIVerknuepfungen End Function Private Sub EnableBtnLink() - btnLink.Enabled = - lbxWMIndex.SelectedItems.Count > 0 And - (lbxQuelle1.SelectedItems.Count > 0 OrElse txtManIndexwert.Text <> "") + If Me._selectedProfil Is Nothing Then + btnLink.Enabled = False + Return + End If + + Select Case Me._selectedProfil.Ni_Art + Case "db", "activedirectory" + btnLink.Enabled = + lbxWMIndex.SelectedItems.Count > 0 And + (lbxQuelle1.SelectedItems.Count > 0 OrElse txtManIndexwert.Text <> "") + + Case "xml" + btnLink.Enabled = + lbxWMIndex.SelectedItems.Count > 0 And + (trvwxml.SelectedNode IsNot Nothing OrElse txtManIndexwert.Text <> "") + + Case "fulltext" + btnLink.Enabled = + lbxWMIndex.SelectedItems.Count > 0 And + (txtregex.Text <> "" OrElse txtManIndexwert.Text <> "") + + Case Else + btnLink.Enabled = False + End Select End Sub Private Sub btnLink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLink.Click @@ -3463,6 +3484,7 @@ Public Class frmNIVerknuepfungen End If End If + EnableBtnLink() 'Catch ex As Exception ' MsgBox("Fehler bei Check Änderung Regex:" & vbNewLine & vbNewLine & ex.Message, MsgBoxStyle.Critical) 'End Try @@ -3611,8 +3633,7 @@ Public Class frmNIVerknuepfungen End Sub Private Sub trvwxml_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles trvwxml.AfterSelect - - + EnableBtnLink() End Sub Private Sub tabctrlbottom_SelectedIndexChanged(sender As Object, e As EventArgs) Handles tabctrlbottom.SelectedIndexChanged