Quote Originally Posted by jmcilhinney View Post
I think you want something like this:
Public myColor As New Color_Class(Me)
Thanks for the fast answer. What's the significance of (Me) in that declaration?

I have to say though, from the example that you've provided I can't see any advantage to defining a nested class over just putting that behaviour in the control itself.
Well, I'm probably mis-guided, but I like the idea of a class that contains many sub-classes.

Like:

vb.net Code:
  1. Class Machine
  2.   Public Name As String
  3.  
  4.   Class Modes
  5.      Private _currentMode as Byte
  6.      Public Const OFF as Byte = 0
  7.      Public Const ON as Byte = 1
  8.      Public Const Standby as Byte = 2
  9.  
  10.      Property Mode() as byte
  11.          Get
  12.              Mode = _currentMode
  13.          End Get
  14.          Set(ByVal value as byte)
  15.              If value >=0 and value <=2 Then
  16.                  _currentMode = value
  17.              End If
  18.       End Property
  19.  
  20.       Sub ChangeMode()
  21.            Machine.Operate(_currentMode)
  22.       End Sub
  23.   End Class
  24. End Class
  25. .
  26. .
  27. .
  28. Public myMachine as new Machine
  29. myMachine.Name = "Herbert"
  30. myMachine.Mode = myMachine.Modes.ON
  31. myMachine.Mode.ChangeMode

I guess you're suggesting that I don't bother?