VB.NET•Custom Editors Need Help

Listing 3. A custom drop-down editor requires two custom classes, one of which is a "go-between" class. It's responsible for communication between the PropertyGrid and the drop-down user interface.

Public Class LatLongEditor
   Inherits UITypeEditor
   Public Overloads Overrides _
      Function GetEditStyle(...)
      Return UITypeEditorEditStyle.DropDown
   End Function
   Public Overloads Overrides _
   Function EditValue( _
      context, provider, value) As Object
      ' ----- Prompt with a drop-down.
      Dim uiDisplay As New LatLongEditorUI
      uiDisplay.EditorService = _
      uiDisplay.GeogLocation = _
         CType(value, LatLong)

      ' ----- Display the editor,
      '       return the result.
      Return uiDisplay.GeogLocation
   End Function
End Class