Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am having a problem with getting a menu item to check or uncheck. Any suggestions on what's going wrong with this? It obviously keeps the form on top of other windows when I can get it working.

 

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click

 

If MenuItem3.Checked = False Then

 

Me.TopMost = False

 

Else

 

MenuItem3.Checked = True

 

Me.TopMost = True

 

End If

 

End Sub

 

 

 

Thanks in advance for those that reply

  • Administrators
Posted

You will also need to check / uncheck the item yourself.

 

   Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
       MenuItem3.Checked = Not MenuItem3.Checked

       If MenuItem3.Checked = False Then

           Me.TopMost = False

       Else

           MenuItem3.Checked = True

           Me.TopMost = True

       End If

   End Sub

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • Leaders
Posted

Shouldn't you be making the checkmark inside of the If statement, and making it False in the Else statement?

Also, you could just use

MenuItem3.Checked = Not MenuItem3.Checked

:).

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

  • *Experts*
Posted
Actually, the method used by PlausiblyDamp is pretty cool!!! You could put that into a loop and go through all the menu items quickly.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...