Home All Groups Group Topic Archive Search About

contextMenu Problem!!!

Author
10 Aug 2006 1:39 PM
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

Author
10 Aug 2006 2:48 PM
Larry Lard
zulan***@gmail.com wrote:
> 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


>                     End If
>                 Next
>


--
Larry Lard
larryl***@googlemail.com
The address is real, but unread - please reply to the group
For VB and C# questions - tell us which version
Author
10 Aug 2006 2:55 PM
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



Larry Lard wrote:
Show quoteHide quote
> zulan***@gmail.com wrote:
> > 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
>
>
> >                     End If
> >                 Next
> >
>
>
> --
> Larry Lard
> larryl***@googlemail.com
> The address is real, but unread - please reply to the group
> For VB and C# questions - tell us which version
Author
10 Aug 2006 3:38 PM
Claes Bergefall
You need a cast
CType(Mnu_Sys_over.Items(z), ToolStripMenuItem).Checked = True

   /claes

Show quoteHide quote
"Zulander" <zulan***@gmail.com> wrote in message
news:1155221738.246452.263970@i3g2000cwc.googlegroups.com...
> 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
>
>
>
> Larry Lard wrote:
>> zulan***@gmail.com wrote:
>> > 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
>>
>>
>> >                     End If
>> >                 Next
>> >
>>
>>
>> --
>> Larry Lard
>> larryl***@googlemail.com
>> The address is real, but unread - please reply to the group
>> For VB and C# questions - tell us which version
>