Re: Arghhh...strict, but not strict enough

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Armin Zingler" <az.nospam@xxxxxxxxxx> wrote in message news:uvuMWtcuJHA.3848@xxxxxxxxxxxxxxxxxxxxxxx
John Whitworth wrote:
I'm sure it's probably glaringly obvious to someone, but I can't work
out what to do. I can see that a ToolStripItem isn't a
ToolStripMenuItem, but how do I get around this?

If you know that the reference will always reference a ToolStipMenuItem, use type casting:

SelectedReaderMenu = directcast(e.ClickedItem, toolstripmenuitem)



Armin


Thanks Armin - I got there from Patrice's message. But is there a difference between CType and directcast?

John

.



Relevant Pages

  • Re: Arghhh...strict, but not strict enough
    ... DirectCast is used when cating to the true underlying type that a reference ... points to and the validity of the cast need not be verified before the cast ... ToolStripMenuItem, but how do I get around this? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Arghhh...strict, but not strict enough
    ... John Whitworth wrote: ... ToolStripMenuItem, but how do I get around this? ... If you know that the reference will always reference a ToolStipMenuItem, ... Armin ...
    (microsoft.public.dotnet.languages.vb)