contextMenu Problem!!!

Z

zulander

hi tring to make a Menu Item Cheked but it doesn't seem to work, any
sugestions ?

'Add Items

Dim countera As Integer
For countera = 0 To 15
Mnu_Sys_over.Items.Add(countera).Tag = countera
'Do i have set the name of the menu item too ?
Next


'Check item

For z = 0 To Mnu_Sys_over.Items.Count - 1
If Mnu_Sys_over.Items(z).Tag =
ListView1.Items(COuntera).Tag Then
Dim SelectedMnuItem As New
MenuItem(Mnu_Sys_over.Items(z).Text)
SelectedMnuItem.Checked = True
End If
Next
 
L

Larry Lard

hi tring to make a Menu Item Cheked but it doesn't seem to work, any
sugestions ?

'Add Items

Dim countera As Integer
For countera = 0 To 15
Mnu_Sys_over.Items.Add(countera).Tag = countera
'Do i have set the name of the menu item too ?

If you want to...
Next


'Check item

For z = 0 To Mnu_Sys_over.Items.Count - 1
If Mnu_Sys_over.Items(z).Tag =
ListView1.Items(COuntera).Tag Then
Dim SelectedMnuItem As New
MenuItem(Mnu_Sys_over.Items(z).Text)
SelectedMnuItem.Checked = True

This creates a new menu item, sets it to be checked, and then throws it
away. Instead of these two lines, you probably mean
Mnu_Sys_over.Items(z).Checked = True
 
Z

Zulander

Lard ,
well i have tried that but the
Mnu_Sys_over.Items(z).Checked does exist !

Error 1 'Checked' is not a member of
'System.Windows.Forms.ToolStripItem'.
thank you
 
C

Claes Bergefall

You need a cast
CType(Mnu_Sys_over.Items(z), ToolStripMenuItem).Checked = True

/claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top