Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. disable tabpages click & click treenode to control pages selected

disable tabpages click & click treenode to control pages selected

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sanyexian
    wrote on last edited by
    #1

    Hello,everyone! I've knowan how to click treenode to make tabpages selected and show, but I don't want users could click the tabpage and selected one of them. I searched in internet and found that it should use a intenger such as "tab = 1" in some Tabcontrol and Tabpage events like this webpage said whick use TabPage1_Validating & TabPage1_Enter like below :

    Private Sub TabPage1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TabPage1.Validating
    If tab = 1 Then
    e.Cancel = True
    Else
    e.Cancel = False
    End If
    End Sub

    Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Enter
    tab = 1 ' setting the selected tab when user gets back to this tab
    End Sub

    I tried it and now the tabpage could not click,but when I clicked treenode, it could not selected tabpage too.In fact,I didn't understand how the code in the webpage made tabpage disable click after I looked up in MSDN... X| Could anyone give me some suggestions and help? Thanks a lot!

    D 1 Reply Last reply
    0
    • S sanyexian

      Hello,everyone! I've knowan how to click treenode to make tabpages selected and show, but I don't want users could click the tabpage and selected one of them. I searched in internet and found that it should use a intenger such as "tab = 1" in some Tabcontrol and Tabpage events like this webpage said whick use TabPage1_Validating & TabPage1_Enter like below :

      Private Sub TabPage1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TabPage1.Validating
      If tab = 1 Then
      e.Cancel = True
      Else
      e.Cancel = False
      End If
      End Sub

      Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Enter
      tab = 1 ' setting the selected tab when user gets back to this tab
      End Sub

      I tried it and now the tabpage could not click,but when I clicked treenode, it could not selected tabpage too.In fact,I didn't understand how the code in the webpage made tabpage disable click after I looked up in MSDN... X| Could anyone give me some suggestions and help? Thanks a lot!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Why not just scrap the TabControl and use a stack of Panels instead?

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups