PC Review


Reply
Thread Tools Rate Thread

Cannot Get MenuItem's name[Notsolved]

 
 
Agnes
Guest
Posts: n/a
 
      29th Mar 2005
I understand that Name is not the property of Menuitem.
I try the following web site provide by Mick
There's a MenuExtender example on my site that adds a Tag and RadioGroup
property to menuitems.
You will find source in both VB and C#
http://dotnetrix.co.uk/menus.html

I know how to fill the property now, HOWEVER, During Form load, How can I
get that menuitem's Tag property??
I try .Me.newmenuItem.XXX <-- There is no such property in coding ??
Please help


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      29th Mar 2005
Agnes,

There is no menuitem.tag
http://msdn.microsoft.com/library/de...mberstopic.asp

Therefore the only thing I can come up to is to create your own menuitem
class. I made a little sample for you.

\\\Needs only a blanco application and pasting this in.
Friend WithEvents MainMenu1 As MainMenu
Friend WithEvents MenuItem1 As MenuItemAgnes
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
MainMenu1 = New MainMenu
MenuItem1 = New MenuItemAgnes
MainMenu1.MenuItems.Add(MenuItem1)
MenuItem1.Text = "Agnes"
MenuItem1.Tag = "Whatever"
Me.Menu = Me.MainMenu1
End Sub
Private Sub MenuItem1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MenuItem1.Click
MessageBox.Show(MenuItem1.Tag.ToString)
End Sub
End Class
Friend Class MenuItemAgnes
Inherits MenuItem
Private mTag As Object
Public Property Tag() As Object
Get
Return mTag
End Get
Set(ByVal Value As Object)
mTag = Value
End Set
End Property
End Class
///

I hope this helps a little bit?

Cor


 
Reply With Quote
 
Mick Doherty
Guest
Posts: n/a
 
      29th Mar 2005
Hi Cor,
Agnes was refering to the extended Tag property from my MenuExtender
example.

I answered this in other thread.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html


"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Agnes,
>
> There is no menuitem.tag
> http://msdn.microsoft.com/library/de...mberstopic.asp
>
> Therefore the only thing I can come up to is to create your own menuitem
> class. I made a little sample for you.
>
> \\\Needs only a blanco application and pasting this in.
> Friend WithEvents MainMenu1 As MainMenu
> Friend WithEvents MenuItem1 As MenuItemAgnes
> Private Sub Form1_Load(ByVal sender As System.Object, _
> ByVal e As System.EventArgs) Handles MyBase.Load
> MainMenu1 = New MainMenu
> MenuItem1 = New MenuItemAgnes
> MainMenu1.MenuItems.Add(MenuItem1)
> MenuItem1.Text = "Agnes"
> MenuItem1.Tag = "Whatever"
> Me.Menu = Me.MainMenu1
> End Sub
> Private Sub MenuItem1_Click(ByVal sender As Object, _
> ByVal e As System.EventArgs) Handles MenuItem1.Click
> MessageBox.Show(MenuItem1.Tag.ToString)
> End Sub
> End Class
> Friend Class MenuItemAgnes
> Inherits MenuItem
> Private mTag As Object
> Public Property Tag() As Object
> Get
> Return mTag
> End Get
> Set(ByVal Value As Object)
> mTag = Value
> End Set
> End Property
> End Class
> ///
>
> I hope this helps a little bit?
>
> Cor
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      29th Mar 2005
Mick,

I was reading topdown, I saw later that there was already a long thread with
you involved, however than I had already made that sample and when you have
sent something you cannot correct that anymore.

I would have made another message when I had understood that in advance.

(You probably know the text from that already)

:-)

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MenuItem Finn Stampe Mikkelsen Microsoft C# .NET 2 7th Apr 2011 03:02 PM
Set a MenuItem's ID Saul775 Microsoft C# .NET 2 30th Jan 2008 06:50 PM
Reboot and select proper boot device problem NOTsolved Philip Nicholls DIY PC 4 25th Nov 2006 05:02 PM
Adding to an existing MenuItem's MenuItem Collection Dynamically snesbit Microsoft Dot NET Framework Forms 3 9th Mar 2005 03:08 AM
Adding to an existing MenuItem's MenuItem Collection Dynamically snesbit Microsoft VB .NET 1 9th Mar 2005 03:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:15 PM.