2012-10-16 63 views
-1

我想遍歷ContextMenuStrip中的所有項目。在VB.NET中迭代ContextMenuStrip項目

有人可以幫我一下嗎?

我是想這一點,但沒有奏效:

For Each it As ToolStripItem In Me.ContextMenuStrip1.Items 

謝謝!

+1

對我來說這看起來是正確的,錯誤是什麼意思? –

+0

大聲笑,對不起!該錯誤說「添加一個'下一個'」:-) – tmighty

回答

1

這個錯誤對我來說很清楚=)。在您的循環結束處添加Next這個詞。

For Each it As ToolStripItem In Me.ContextMenuStrip1.Items 
    'Loop Contents 
Next