473,686 Members | 2,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need some help with vb StatusStrip Control

Hello,

I have a vb.net form that I've added a StatusStrip at the bottom. On that
StatusStrip I've added a DropDownButton on which I've added a Menu
containing 4 sub Items

What I am trying to do is cycle through the Menu's subitems one by one and
uncheck or check the items instead of setting them all individually.

So, here's what I want to avoid:

Private Sub SubToolStripMen uItem1_Click(By Val sender As System.Object, ByVal
e As System.EventArg s) Handles SubToolStripMen uItem1.Click

SubToolStripMen uItem.Checked = False
SubToolStripMen uItem1.Checked = False
SubToolStripMen uItem2.Checked = False
SubToolStripMen uItem3.Checked = True

End Sub

My DropDownButton is called: ToolStripDropDo wnButton1

My Menu that contains the 4 sub items is called: MyToolStripMenu Item

My sub items are: SubToolStripMen uItem, SubToolStripMen uItem1,
SubToolStripMen uItem2, SubToolStripMen uItem3

I've googled groups until my eyes have bled and I can't find an answer. I'd
like to use something like this:

Dim MI as MenuItem

For each MI in MyMenu.MenuItem s
MI.Checked = false
Next
CType(sender, MenuItem).Check ed = true

The problem is that I can't find a way to attach to the menu and get a hold
of each menu items .checked property.

Any ideas or pointers would be very helpful. I am trying to move from VB6
to .net and am having some headaches along the way.

Thanks,

Marc


Mar 11 '06 #1
5 3077

"Marc" <ma**@home.co m> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
What I am trying to do is cycle through the Menu's subitems one by one and
uncheck or check the items instead of setting them all individually.


I was watching some of "Fahrenheit 451" on TV today. "Burn all the books,
they only make you unhappy". Hmmm, makes you think.

Here is some lousy code:

Dim thing
For Each thing In ToolStripDropDo wnButton1.DropD ownItems
thing.checked = False
Next

Mar 12 '06 #2
Hey,

Thank you for the code, I tried it and found out it is only affecting the
DropDownButton menu but not the Sub ToolStripMenuIt ems. Let me see if I can
ASCII art what's happening here:

DropDownButton1
|
-TestToolStripMe nuItem (Code below checks this menu when I set
thing.checked = true)
|
-- Test1ToolStripM enuItem
-- Test2ToolStripM enuItem
-- Test3ToolStripM enuItem
-- Test4ToolStripM enuItem
|
-TestTwoToolStri pMenuItem (Code below checks this menu when I set
thing.checked = true)

So, here I have two main menus off of DropDownButton1 . One menu called
"Test", the other called "Test two". The menu "Test" has sub items inside
it labeled "Test1", "Test2", "Test3" and "Test4". These Menu Items are the
ones I'm trying to check and uncheck. Your code below works perfectly to
check or uncheck the two "Top Level" menus on the button but not the
subitems.

The problem is trying to get to the subitme(s).chec ked property - I'm at a
loss here. and that's why in each subitems clicked event I've had to
hard-code this mess:

Private Sub Test1ToolStripM enuItem_Click(B yVal sender As System.Object,
ByVal
e As System.EventArg s) Handles Test1ToolStripM enuItem.Click

Test1ToolStripM enuItem.Checked = True
Test2ToolStripM enuItem.Checked = False
Test3ToolStripM enuItem.Checked = False
Test4ToolStripM enuItem.Checked = False

End Sub

"Homer J Simpson" <no****@nowhere .com> wrote in message
news:5rJQf.2261 6$vC4.10903@clg rps12...

"Marc" <ma**@home.co m> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
What I am trying to do is cycle through the Menu's subitems one by one
and uncheck or check the items instead of setting them all individually.


I was watching some of "Fahrenheit 451" on TV today. "Burn all the books,
they only make you unhappy". Hmmm, makes you think.

Here is some lousy code:

Dim thing
For Each thing In ToolStripDropDo wnButton1.DropD ownItems
thing.checked = False
Next

Mar 12 '06 #3

"Marc" <ma**@home.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Thank you for the code, I tried it and found out it is only affecting the
DropDownButton menu but not the Sub ToolStripMenuIt ems. Let me see if I
can ASCII art what's happening here:


You will probably need to figure out which collection these items are in and
then access it via that collection and its members. That seems to be the way
things work now.

Mar 12 '06 #4

"Marc" <ma**@home.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Thank you for the code, I tried it and found out it is only affecting the
DropDownButton menu but not the Sub ToolStripMenuIt ems. Let me see if I
can ASCII art what's happening here:


http://samples.gotdotnet.com/quickstart/ might be worth a browse too.

Mar 12 '06 #5
On Sat, 11 Mar 2006 12:39:13 -0800, "Marc" <ma**@home.co m> wrote:
Hello,

I have a vb.net form that I've added a StatusStrip at the bottom. On that
StatusStrip I've added a DropDownButton on which I've added a Menu
containing 4 sub Items

What I am trying to do is cycle through the Menu's subitems one by one and
uncheck or check the items instead of setting them all individually.

So, here's what I want to avoid:

Private Sub SubToolStripMen uItem1_Click(By Val sender As System.Object, ByVal
e As System.EventArg s) Handles SubToolStripMen uItem1.Click

SubToolStripMen uItem.Checked = False
SubToolStripMen uItem1.Checked = False
SubToolStripMen uItem2.Checked = False
SubToolStripMen uItem3.Checked = True

End Sub

My DropDownButton is called: ToolStripDropDo wnButton1

My Menu that contains the 4 sub items is called: MyToolStripMenu Item

My sub items are: SubToolStripMen uItem, SubToolStripMen uItem1,
SubToolStripMe nuItem2, SubToolStripMen uItem3

I've googled groups until my eyes have bled and I can't find an answer. I'd
like to use something like this:

Dim MI as MenuItem

For each MI in MyMenu.MenuItem s
MI.Checked = false
Next
CType(sender , MenuItem).Check ed = true

The problem is that I can't find a way to attach to the menu and get a hold
of each menu items .checked property.

Any ideas or pointers would be very helpful. I am trying to move from VB6
to .net and am having some headaches along the way.

Thanks,

Marc
I'm not all that sure what you are trying to accomplish, but if you
are simply trying to ensure that only the currently selected menu item
is checked, you can do this:
(Uses default names, VB2005)

In each MenuItem_Click Event add these two lines:
ClearChecks()
CType(sender, ToolStripMenuIt em).Checked = True

Add this Sub:

Private Sub ClearChecks()
Dim MI As ToolStripMenuIt em
For Each MI In Me.ToolStripDro pDownButton1.Dr opDownItems
MI.Checked = False
Next
End Sub

Gene

Mar 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1378
by: Jim Hubbard | last post by:
When you add a StatusStrip to a WinForm and add a Progressbar to the StatusStrip, setting the Progressbar alignment to "Right" does not move the Progressbar to the right on the Statusbar. Is this a bug?
3
25392
by: windsurfing_stew | last post by:
Hi, Winforms has the new StatusStrip control that replaces StatusBar in 1.1. I've looked high and low but can't seem to find how to get separators (|) in my status bar, eg Info1 | Info2 | Info3 | Info4 where Infos 1 to 4 are StatusLabels.
2
4449
by: robertino | last post by:
Hi all, (VS 2005 Pro, XP) I'm trying to place a statusstrip control on a window such that it acts like a statusstrip (!). Every time I try this, no matter what I do, I find that when I maximise other containers on the form to fill its' available surface, then these other controls slip behind the statusstrip to fill ALL the form's surface as if the statusstrip didn't even exist!. Statustrip dock property is bottom, other controls all...
0
2020
by: Rich | last post by:
Hello, I just upgraded a vb2003 app to vb2005. The vb2003 app had/has a statusbar object - which contains panels and I can see the properties of the statusbar in the properties window in vb2005. But in the tools list of vb2005 I do not see a statusbar selection. Instead I see a statusStrip, and even though the Items collection has a property to set the statusStrip labels to sunken, etched,... I can see these appearances when I...
6
3203
by: Jon Slaughter | last post by:
When I used to program in windows(back in the days of win95/98) the help system was very good. You could find out all th details of just about anything with usually decent explinations of what does what. Now I can't see to find any time of descriptions that actually describe what means what. Am I just looking in the wrong place. For example, I made a statusStrip control for use in my application. I put in a text box and a progress bar...
0
3521
by: =?Utf-8?B?UmljaA==?= | last post by:
I have a statusStrip on a form with some ToolStripStatusLabels - which function as Previous Record/Next Record, New Record buttons. And instead of text, I place an image on the ToolStripStatusLabels (prevArrow, NextArrow...). I wanted to add a tooltip to these labels (that resemble buttons). But VB2005 is complainng that I can't convert a ToolStripStatusLabel to a control. Is it possible to set a tooltip to a StatuStrip...
1
21029
by: Carla Simeoni | last post by:
I added a StatusStrip "Sstrip1" to a Form "Form1". In the procedure private void Form1_Load(...) I added the following statement: Sstrip1.Text = "Text in my StatusStrip";
10
5842
by: hzgt9b | last post by:
Using VS2005 (.NET 2.0), VB.NET, I have a windows forms application. I have a StatusStrip containing a ToolStripStatusLabal and a ToolStripProgressBar. I want to force the status label to behave like it's docked to "Fill" inside the StatusStrip and force the progress bar to behave like it's docked to "Right" inside the StatusStrip. Unfortunately I do not see any way to accomplish this using just one StatusStrip control. Does anyone...
1
1632
by: Benj Nunez | last post by:
Hello everyone, I noticed that the statusStrip control seems to be always "raised". I tried looking for a property that would change this behavior. I tried the LayoutSyle property but it has no effect whatsoever. Any ideas? Thanks in advance.
0
8584
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8516
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8932
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7599
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6440
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4308
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2205
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.