Results 1 to 2 of 2

Thread: Button disable help.

  1. #1

    Thread Starter
    Member
    Join Date
    May 2012
    Posts
    38

    Exclamation Button disable help.

    Hello, i need help with a button function. i am working on an advanced program that uses a richtextbox and tabcontrol. I have 2 buttons for adding pages and removing pages. I need it so when you get to 10 pages the add pages button will disable. I know this is simple and i usually figure this kind of things out myself but i am having a hard time concentrating. Here is the code im using now but it is for a msgbox to show up:
    Code:
            Dim RTB As New RichTextBox
            If A = 11 Then
                MsgBox("you cannot have more than 10 tabs open!")
            Else
                TabControl1.TabPages.Add(1, "Page " & A)
                TabControl1.SelectTab(A - 1)
                RTB.Name = "TE"
                RTB.ScrollBars = RichTextBoxScrollBars.Both
                RTB.Dock = DockStyle.Fill
                TabControl1.SelectedTab.Controls.Add(RTB)
                A = A + 1
            End If
    Please help!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Button disable help.

    The Enabled property of the Button is type Boolean. What would be a Boolean expression that tells you whether there 10 tabs in your TabControl? Maybe:
    Code:
    myTabControl.TabPages.Count < 10
    Simply assign the result of that to the Enabled property.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width