|
-
Feb 6th, 2004, 02:46 PM
#1
Thread Starter
Lively Member
MenuItem problem [Resolved]
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
Last edited by teamdad; Jun 13th, 2004 at 08:17 PM.
-
Feb 6th, 2004, 05:55 PM
#2
Hi.
I think your problems is, that you check wether the item is checked. if not you don't do any thing to the item.
If it is checked, you set to checked, which it allready is. So that way, it will allways be checked.
Try changing your code to this.
VB Code:
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
'Toggle the state of the item
MenuItem3.Checked=Not MenuItem3.Checked
If MenuItem3.Checked = False Then
Me.TopMost = False
Else
Me.TopMost = True
End If
End Sub
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Feb 7th, 2004, 04:19 PM
#3
Member
Or you could make that a little bit simpler...
VB Code:
Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click
'Toggle the state of the item
MenuItem3.Checked=Not MenuItem3.Checked
Me.TopMost = MenuItem3.Checked
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|