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. Invoking a Control by its Name string?

Invoking a Control by its Name string?

Scheduled Pinned Locked Moved Visual Basic
questioncsharpdata-structures
1 Posts 1 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.
  • W Offline
    W Offline
    watagal
    wrote on last edited by
    #1

    Greetings! I want to switch controls (panels) visibility by using their respective names (in variables). How can I get there from here:

    Public prefPanel As Panel = New Panel()
    Private Sub uxcPreferencesForm_Load(....) Handles MyBase.Load
        prefPanel = Me.uxcGeneralPnl    ' Startup Panel
        prefPanel.Visible = True
    End Sub
    Private Sub uxCatagoryTree_AfterSelect(....) Handles uxCatagoryTree.AfterSelect
        prefPanel.Visible = False       ' Hide Current Panel
    
        Dim path As String = uxCatagoryTree.SelectedNode.FullPath
        Dim arrPath As Array = path.Split("\")
    
        Dim panl As String = "uxc"      ' Formulate new Panel's name
        For i As Integer = 0 To (arrPath.Length - 2)
           panl += arrPath(i).ToString.Substring(0, 3)
        Next i
        panl += arrPath(arrPath.Length - 1).ToString + "Pnl"
    
        prefPanel.Name = panl       ' HERE IS WHERE I GET LOST
        prefPanel.Visible = True        ' Show New Current Panel
        uxHeadingLbl.Text = panl  'path
    End Sub
    

    The panels are all created (and designed) at compile time - they are invisible. Is there a way to handle this switching? Thanks, Karen Nooobie to OOP and VB.Net 2005

    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