0

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.

6
Contributors
7
Replies
8
Views
4 Years
Discussion Span
Last Post by Dzulham
Featured Replies
  • 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 Read More

  • 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 Read More

0

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

2

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
0

You could also replace

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

with

EnableDisableMyControls(tabC.Tabcount = 1)
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.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.