Im new here and i want to make this code more simple:

If tabC.TabCount = 1 Then
            NClose.Enabled = False
            CloseNote.Enabled = False
            CloseNoteContext.Enabled = False
            CloseNoteX.Enabled = False
        Else
            NClose.Enabled = True
            CloseNote.Enabled = True
            CloseNoteContext.Enabled = True
            CloseNoteX.Enabled = True
        End If

I try this
NClose.Enabled, CloseNote.Enabled, CloseNoteContext.Enabled = True
But won't work. I want to google it, but don't know what keyword to type.

What exactly do you want to do? Please exert some effort into putting more details to your questions so others may help you out. ^^ God bless

Hi,

You could try something like:

Private Sub EnableDisableMyControls (Optional ByVal bEnabled As Boolean =TRUE)
    NClose.Enabled = bEnabled
    CloseNote.Enabled = bEnabled
    CloseNoteContext.Enabled = bEnabled
    CloseNoteX.Enabled = bEnabled
End Sub

If tabC.TabCount =1 Then
    EnableDisableMyControls(TRUE)
Else
    EnableDisableMyControls(FALSE)
End if

You could also replace

If tabC.TabCount =1 Then
    EnableDisableMyControls(TRUE)
Else
    EnableDisableMyControls(FALSE)
End if

with

EnableDisableMyControls(tabC.Tabcount = 1)

Those are some pretty great answers. Leave it the way you have it.

Dim Enabled as boolean = tabC.tabcount <> 1

NClose.Enabled = Enabled
CloseNote.Enabled = Enabled
CloseNoteContext.Enabled = Enabled
CloseNoteX.Enabled = Enabled
This question has already been answered. Start a new discussion instead.