Enable btnLink only when valid selections are made

Added EnableBtnLink method to control btnLink's enabled state based on lbxWMIndex and lbxQuelle1 selections or txtManIndexwert input. btnLink is now disabled by default and updated dynamically via selection change handlers.
This commit is contained in:
OlgunR
2026-03-12 17:12:50 +01:00
parent 3001ccf43f
commit 9613682fe0
2 changed files with 18 additions and 0 deletions

View File

@@ -1763,6 +1763,7 @@ Partial Class frmNIVerknuepfungen
'
'btnLink
'
Me.btnLink.Enabled = False
Me.btnLink.Image = Global.ToolCollection.My.Resources.Resources.link
Me.btnLink.ImeMode = System.Windows.Forms.ImeMode.NoControl
Me.btnLink.Location = New System.Drawing.Point(409, 167)

View File

@@ -560,6 +560,7 @@ Public Class frmNIVerknuepfungen
Next
End If
EnableBtnLink()
End If
@@ -1393,6 +1394,13 @@ Public Class frmNIVerknuepfungen
End Try
End Function
Private Sub EnableBtnLink()
btnLink.Enabled =
lbxWMIndex.SelectedItems.Count > 0 And
(lbxQuelle1.SelectedItems.Count > 0 OrElse txtManIndexwert.Text <> "")
End Sub
Private Sub btnLink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLink.Click
' wenn im ListView ein Element selektiert wurde
If Me.lvwVerknuepfungen.SelectedItems.Count > 0 Then
@@ -2829,6 +2837,8 @@ Public Class frmNIVerknuepfungen
Else
grbFilterDB.Enabled = True
End If
EnableBtnLink()
End Sub
Private Sub txtGrundgeruest_check_Click(sender As System.Object, e As System.EventArgs) Handles txtGrundgeruest_check.Click
Me.txtCheckIndexSQL.Text = "SELECT COUNT(*) FROM [%view] WHERE "
@@ -3522,7 +3532,14 @@ Public Class frmNIVerknuepfungen
If _selectedIndex_Type Is Nothing = False Then
visinvisible_Vektor_ins_State()
End If
EnableBtnLink()
End Sub
Private Sub lbxQuelle1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles lbxQuelle1.SelectedIndexChanged
EnableBtnLink()
End Sub
Sub visinvisible_Vektor_ins_State()
If _selectedIndex_Type.StartsWith("Vektor") Then
Me.rbvkt_add.Visible = True