|
-
Jun 24th, 2004, 08:56 AM
#1
Thread Starter
Addicted Member
Menu Items [RESOLVED]
Here is my menu
I want to click Red and have a check by it only. The when I click Yellow have a check by it only.
When I write my click event like this: mnuRed.Checked = True
It will check it but will not uncheck Blue.
Last edited by twisted; Jun 24th, 2004 at 09:23 AM.
Twisted
-
Jun 24th, 2004, 09:05 AM
#2
Thread Starter
Addicted Member
I wrote it like this:
VB Code:
Private Sub mnuGreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGreen.Click
mnuGreen.Checked = True
mnuBlue.Checked = False
mnuRed.Checked = False
mnuYellow.Checked = False
Me.BackColor = System.Drawing.Color.Green
End Sub
Is there any easier way??
-
Jun 24th, 2004, 09:19 AM
#3
Hyperactive Member
Yes, you can create a variable that holds the index of the currently selected menuitem and then uncheck just that menu when you are selecting a new menuitem.
Lets say you have a menu named mnuColors and that has 4 MenuItems on it
In your mnuClick code you can code it like this
VB Code:
Private mnuSelIndx As Int32
Private Sub mnuGreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuGreen.Click
mnuColor.MenuItems(mnuSelIndx).Checked = False
mnuGreen.Checked = True
mnuSelIndx = mnuGreen.Index
Me.BackColor = System.Drawing.Color.Green
End Sub
-
Jun 24th, 2004, 09:23 AM
#4
Thread Starter
Addicted Member
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
|