Results 1 to 6 of 6

Thread: disable TextBox

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    5

    disable TextBox

    Hello,
    I was looking for a way to disable a TabPage of a TabControl object.
    Do you know if it is possible?
    Thank you

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051

    Re: disable TextBox

    Welcome to the forums!
    Code:
    MyTabControlTabPages[IndexOfTabToDisable].CanSelect = false;
    I think that'll do it.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    5

    Re: disable TextBox

    Unfortunately it doesn't function (CanSelect is a read-only property...)
    I also tried with CanFocus property, but it's the same (it's read-only too).

    Then, I also tried to use the Hide() method (I would prefer to disable and not to hide the TabPage, however), but the statement has no effect (the TabPage remains visible).

  4. #4
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276

    Re: disable TextBox

    Try this:

    tabControl1.TabPages[0].Enabled = false;

    Although, the IDE does not give the .Enabled property option, this works.

    Thanks
    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2005
    Posts
    5

    Re: disable TextBox

    I tried to use the Enabled property in both the ways:

    tabControl1.TabPages[0].Enabled = false;

    tabPage0.Enabled = false;

    Even if "Enabled" isn't a TabPage property, the compiler gives no errors and the program runs (as Jemima said), but the problem is still there: the tabPage isn't disabled...

  6. #6
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    India
    Posts
    276

    Re: disable TextBox

    Oh!! When I tried out, I found all the controls on TabPage1 got disabled.

    Well.. let me know if that doesn't happen.. I'll look out if there's an alternate solution.

    Jemima.
    "Your worst days are never so bad that you are beyond the reach of God's grace...
    and your best days are never so good that you are beyond the need of God's grace."

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