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. Tab page issues

Tab page issues

Scheduled Pinned Locked Moved Visual Basic
csharphelpdatabasevisual-studiowinforms
5 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.
  • E Offline
    E Offline
    eatwork
    wrote on last edited by
    #1

    Hi, my problem is that I have a tab control, consisting of 4 tab pages and 4 user controls, 1 user control on each tab page. I would like to call the event method tabcontrol.selectedindex changed to load the data into the user control when the user clicks on the form, and not immediately when the selected index is changed. I need this because when certain users open the application the application will hide/remove a tab page if the user does not have access to that particular page. Upon removal, visual studio.net sets the selected index to the page index immediately before the one being removed. My loading of data was originally located within the load method of the user control itself, but this is causing my application to lag at startup when I need to remove a tabpage because it is loading that page when I remove the tabpage. My code currently looks like eg.: Public Sub tcCompany_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tc_Company.SelectedIndexChanged Select Case UCase(Me.tc_Company.SelectedTab.Name) Case "TP_COMPANYNOTES" 'checks to see if user clicked the notes page If Me.tcmediator.p_ucNotes.comb_companyName.Items.Count <= 0 Then 'checks if combo has data Call Me.tcmediator.p_ucNotes.userClickedForm() 'loads data End If Case "TP_COMPANYCREDIT" 'checks to see if user clicked the credit page If Me.tcmediator.p_ucCredit.comb_companyName.Items.Count <= 0 Then 'checks if combo has data Call Me.tcmediator.p_ucCredit.userClickedForm() 'loads data End If end select end sub Thanks for the help eatwork

    C 1 Reply Last reply
    0
    • E eatwork

      Hi, my problem is that I have a tab control, consisting of 4 tab pages and 4 user controls, 1 user control on each tab page. I would like to call the event method tabcontrol.selectedindex changed to load the data into the user control when the user clicks on the form, and not immediately when the selected index is changed. I need this because when certain users open the application the application will hide/remove a tab page if the user does not have access to that particular page. Upon removal, visual studio.net sets the selected index to the page index immediately before the one being removed. My loading of data was originally located within the load method of the user control itself, but this is causing my application to lag at startup when I need to remove a tabpage because it is loading that page when I remove the tabpage. My code currently looks like eg.: Public Sub tcCompany_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tc_Company.SelectedIndexChanged Select Case UCase(Me.tc_Company.SelectedTab.Name) Case "TP_COMPANYNOTES" 'checks to see if user clicked the notes page If Me.tcmediator.p_ucNotes.comb_companyName.Items.Count <= 0 Then 'checks if combo has data Call Me.tcmediator.p_ucNotes.userClickedForm() 'loads data End If Case "TP_COMPANYCREDIT" 'checks to see if user clicked the credit page If Me.tcmediator.p_ucCredit.comb_companyName.Items.Count <= 0 Then 'checks if combo has data Call Me.tcmediator.p_ucCredit.userClickedForm() 'loads data End If end select end sub Thanks for the help eatwork

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Why not load your control when it becomes visible for the first time ? Christian Graus - Microsoft MVP - C++

      E 1 Reply Last reply
      0
      • C Christian Graus

        Why not load your control when it becomes visible for the first time ? Christian Graus - Microsoft MVP - C++

        E Offline
        E Offline
        eatwork
        wrote on last edited by
        #3

        Hi Christian, thank you for your input, I can't load the control during the load method of the control because the control on the 4th tab page loads immediately after deleting the 5th tab page, because the tab control automatically sets the selected index to the index of the control...not sure how to explain this, but if you delete tab page 5, then the tab control within visual studio will set the selected index to tab 4 upon loading the tab control. when that happens tab 4's load method will execute causing the loading of the form to be an extra 3 seconds slower than it needs to be. Not too sure if that answers your question/answer. or if I am way off base could you explain your solution a little more please? thank you. eatwork

        C 1 Reply Last reply
        0
        • E eatwork

          Hi Christian, thank you for your input, I can't load the control during the load method of the control because the control on the 4th tab page loads immediately after deleting the 5th tab page, because the tab control automatically sets the selected index to the index of the control...not sure how to explain this, but if you delete tab page 5, then the tab control within visual studio will set the selected index to tab 4 upon loading the tab control. when that happens tab 4's load method will execute causing the loading of the form to be an extra 3 seconds slower than it needs to be. Not too sure if that answers your question/answer. or if I am way off base could you explain your solution a little more please? thank you. eatwork

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          No, I meant during the visible changed event. When it becomes visible. Christian Graus - Microsoft MVP - C++

          E 1 Reply Last reply
          0
          • C Christian Graus

            No, I meant during the visible changed event. When it becomes visible. Christian Graus - Microsoft MVP - C++

            E Offline
            E Offline
            eatwork
            wrote on last edited by
            #5

            Thank you Christian for your reply, sorry it took me so long to reply. I will give your suggestion a try. eatwork

            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