Results 1 to 5 of 5

Thread: Change MenuItem Text [Resolved]

  1. #1

    Thread Starter
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166

    Change MenuItem Text [Resolved]

    VB Code:
    1. [color="#0000A0"]Private[/color] [color="#0000A0"]Sub[/color] mnuHidePop_Click([color="#0000A0"]ByVal[/color] sender [color="#0000A0"]As[/color] System.Object, [color="#0000A0"]ByVal[/color] e [color="#0000A0"]As[/color] System.EventArgs) Handles mnuHidePop.Click
    2.         [color="#0000A0"]If[/color] mnuHide.Text = "&Hide" [color="#0000A0"]Then[/color]
    3.             Me.WindowState = FormWindowState.Minimized
    4.             mnuHide.Text = "&Show"
    5.         [color="#0000A0"]ElseIf[/color] mnuHide.Text = "&Show" [color="#0000A0"]Then[/color]
    6.             Me.WindowState = FormWindowState.Normal
    7.             mnuHide.Text = "&Hide"
    8.         [color="#0000A0"]End[/color] [color="#0000A0"]If[/color]
    9.     [color="#0000A0"]End[/color] [color="#0000A0"]Sub[/color]

    Hello.

    I am trying to edit the name of a menu item when I click it. At the moment I am using the code above. With this code the text changes (When i go through it line by line), but it doesn't actually display the changes.

    Anyone know the reason why?

    Many thanks

    Pete
    Last edited by Peter1; Aug 28th, 2003 at 11:46 AM.

  2. #2

    Thread Starter
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166
    Anyone?

  3. #3
    Addicted Member The Phoenix's Avatar
    Join Date
    Aug 2003
    Location
    With my wife
    Posts
    142
    Shouldn't all the references to the menu itme be named "mnuHidePop" instead of "mnuHide"? Like this:

    VB Code:
    1. Private Sub mnuHidePop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHidePop.Click
    2.         If [COLOR=red]mnuHidePop[/COLOR] .Text = "&Hide" Then
    3.             Me.WindowState = FormWindowState.Minimized
    4.             [COLOR=red]mnuHidePop[/COLOR] .Text = "&Show"
    5.         ElseIf [COLOR=red]mnuHidePop[/COLOR] .Text = "&Show" Then
    6.             Me.WindowState = FormWindowState.Normal
    7.             [COLOR=red]mnuHidePop[/COLOR] .Text = "&Hide"
    8.         End If
    9.     End Sub
    Take my love
    Take my land
    Take me where I cannot stand
    I don't care, I'm still free
    You can't take the sky from me...

  4. #4

    Thread Starter
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166
    Ha, whoops. Ta. You should see how many times I get stuff like that mixed up.

    Thanks for your help.

    Pete

  5. #5
    Addicted Member The Phoenix's Avatar
    Join Date
    Aug 2003
    Location
    With my wife
    Posts
    142
    No problem. My theory is that if you ask enough stupid questions, you're bound to know a few answers. And I definately have asked enough stupid questions for one lifetime. I guess I was just overdue for a flash of insight.
    Take my love
    Take my land
    Take me where I cannot stand
    I don't care, I'm still free
    You can't take the sky from me...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width