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. Neutralize click event on Tab

Neutralize click event on Tab

Scheduled Pinned Locked Moved Visual Basic
helptutorialquestion
3 Posts 3 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.
  • T Offline
    T Offline
    tannghia
    wrote on last edited by
    #1

    I don't want users can choose any tab when they click on tabheader.How to do this?Please help me!!!!

    D 1 Reply Last reply
    0
    • T tannghia

      I don't want users can choose any tab when they click on tabheader.How to do this?Please help me!!!!

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Here is a C# code that would do a similar thing. Changing it to VB should not be a big task IMO.

      bool CanSelect = false;
      

      void tabControl1_Selecting(object sender, TabControlCancelEventArgs e) {
      e.Cancel = !CanSelect;
      CanSelect = true;
      }

      Now, set the CanSelect variable to true when you want the selection to happen.

      50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

      P 1 Reply Last reply
      0
      • D dan sh

        Here is a C# code that would do a similar thing. Changing it to VB should not be a big task IMO.

        bool CanSelect = false;
        

        void tabControl1_Selecting(object sender, TabControlCancelEventArgs e) {
        e.Cancel = !CanSelect;
        CanSelect = true;
        }

        Now, set the CanSelect variable to true when you want the selection to happen.

        50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!

        P Offline
        P Offline
        Paul Hasler
        wrote on last edited by
        #3

        The VB.Net for d@nish's code might be something like:

        Private Sub TabControl1_Selecting(ByVal sender As Object, ByVal e As System.Windows.Forms.TabControlCancelEventArgs) Handles TabControl1.Selecting
        e.Cancel = Not CanSelect
        End Sub

        i.e. If CanSelect is True then .......... Don't cancel the TabControl1_Selecting event If CanSelect is False then ......... Do cancel the TabControl1_Selecting event

        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