By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,556 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,556 IT Pros & Developers. It's quick & easy.

Nested Control Declarations (using Classes, perhaps?)

P: n/a
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_MapEditor_TabControl_TileP roperties_TabPage_Graph
ic_Button_AddGraphic

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_MapEditor.TabControl_TileP roperties.TabPage_Graph
ic.Button_AddGraphic

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.TabControl
Class TabPage_MapEditor
Public MyParent As New System.Windows.Forms.TabPage
WithEvents PictureBox_Map As New
System.Windows.Forms.PictureBox
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_MapEditor.PictureBox_Map, with no more
generalized reference possible?

Am I even on the right track?
Feb 11 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.