Nested Control Declarations (using Classes, perhaps?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • The Confessor

    Nested Control Declarations (using Classes, perhaps?)

    I have a rather sprawling application-in-progress in Visual Basic .NET
    2003, and I'm using very specific naming conventions to avoid confusion
    and make the function of my code as self-evident as possible.

    Below is an example, the name of a recently-declared Command Button:

    TabControl_Main _TabPage_MapEdi tor_TabControl_ TileProperties_ TabPage_Graph
    ic_Button_AddGr aphic

    I'd love it if I could, in the interests of clarity, refer to that button
    using a more organic structure, such as:

    TabControl_Main .TabPage_MapEdi tor.TabControl_ TileProperties. TabPage_Graph
    ic.Button_AddGr aphic

    After a couple of aborted attempts at using structures (No 'New' or
    'WithEvent' declarations supported therein), I decided to try using
    classes, a previously unexplored frontier.

    I came up with the following:

    Public Class Main
    Inherits System.Windows. Forms.Form
    Class TabControl_Main
    Public MyParent As New System.Windows. Forms.TabContro l
    Class TabPage_MapEdit or
    Public MyParent As New System.Windows. Forms.TabPage
    WithEvents PictureBox_Map As New
    System.Windows. Forms.PictureBo x
    End Class
    End Class
    [Subs & Functions]
    End Class

    How can I make it so that, from any procedure within Class Main, I can
    refer to TabControl_Main 's properties using *only*
    TabControl_Main .MyParent, or PictureBox_Map' s events and properties using
    *only* TabControl_Main .TabPage_MapEdi tor.PictureBox_ Map, with no more
    generalized reference possible?

    Am I even on the right track?
Working...