class ParameterDrivenTextbox ...
Private mMenuAlternativeUnits As ContextMenu
Private mAlternativeUnits As DataTable
Public Function LoadAlternativeUnits() As Boolean
Dim myBR As New BusinessRules.ParameterContainerBR()
Dim aRow As DataRow
Dim aMenuItem As MenuItem
If Not Me.mMenuAlternativeUnits Is Nothing Then
Me.mMenuAlternativeUnits = Nothing
End If
Me.mMenuAlternativeUnits = New ContextMenu()
mAlternativeUnits = myBR.GetAlternativeUnits(me.GUID)
If Not mAlternativeUnits Is Nothing Then
If mAlternativeUnits.Rows.Count > 0 Then
'Build the popup menu ...
For Each aRow In mAlternativeUnits.Rows
aMenuItem = New MenuItem(Utility.ConvertToString(aRow("_AE_Bezeichnung")))
aMenuItem.RadioCheck = True
AddHandler aMenuItem.Click, AddressOf Me.UnitsMenu_Clicked
Me.mMenuAlternativeUnits.MenuItems.Add(aMenuItem)
Next
Return True
Else
Return False
End If
Else
Return False
End If
End Function
Private Sub UnitsMenu_Clicked(ByVal Sender As System.Object, ByVal e As System.EventArgs)
Dim theMenuItem As MenuItem = CType(Sender, MenuItem)
End Sub
Private Sub btnUnit_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles btnUnit.MouseDown
If (e.Button <> MouseButtons.Right) Then
Exit Sub
End If
mMenuAlternativeUnits.Show(btnUnit, New System.Drawing.Point(e.X, e.Y))
End Sub
end class