Passing an unknown type of a menu in a method.

Hi All,
Can somebody help me with the following issue.
I want to pass a menu item to a method of a class. What happens if I do not know the type of the menu in advance (could be Visual Basic's menu or a menu item of a third party manufacturer ( Xceed or Sandbar etc). I think the only way is to pass it as an object and handle it in the target function. But as I do not know the type of the menu, it is not possible to manipulate it there.
Is there a solution for this or not .
[490 byte] By [fanis] at [2008-2-18]
# 1
one way to do that is....

Private sub InputSubroutine(byval oVal as object)

Dim Intval as integer = TryCast(oVal, integer)


end sub

If the conversion was sucessful Intval will have a value; other wise it will be a vbnull.
If you keep doing this on different datatypes util you get a value and then you know what kind of object you have.

Typeless programming is not the the highest performance way to compute but it works. :)

ReneeC at 2007-9-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...