473,787 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference to a control error. Toolstrip

Hello to everyone, I have this code, that gives me an error on the marked
line. It is to make a reference to a submenuitem, to enable it thorgh it
name.
Error line:

For Each oSubitem As ToolStripMenuIt em In oSubmenuItems

error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows .Forms.ToolStri pSeparator' to type
'System.Windows .Forms.ToolStri pMenuItem'."

If anyone knows how to solve this, it would be of great help

Thank you

Manek

Private Sub mkgv2_container _Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.RecorrerEstr ucturaMenu(Me.m en_principal,
mk_sqlre_2("sec _per_cat").ToSt ring)

End Sub

Private Sub RecorrerEstruct uraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)

For Each oOpcionMenu As ToolStripMenuIt em In oMenu.Items

If oOpcionMenu.Dro pDownItems.Coun t > 0 Then

Me.RecorrerSubm enu(oOpcionMenu .DropDownItems, sOpcion)

End If

Next

End Sub

Private Sub RecorrerSubmenu (ByVal oSubmenuItems As ToolStripItemCo llection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems 'ERROR
LINE'|||||||||| ||||||||||||||| |

If oSubitem.Name = sOpcion Then

oSubitem.Enable d = True

End If

If oSubitem.DropDo wnItems.Count > 0 Then

Me.RecorrerSubm enu(oSubitem.Dr opDownItems, sOpcion)

End If

Next

End Sub


Jun 27 '06 #1
2 3564
The ToolStripItemCo llection is a collection of 'ToolStripItem' not
'ToolStripMenuI tems'. So maybe something like this (and I am not sure of
this part)...

For Each oSubitem As ToolStripItem In oSubmenuItems
if TypeOf oSubItem Is ToolStripMenuIt em Then
...
The point being that a ToolStripSepera tor is a ToolStripItem but not a
ToolStripMenuIt em.
--
Terry
"Manekurt" wrote:
Hello to everyone, I have this code, that gives me an error on the marked
line. It is to make a reference to a submenuitem, to enable it thorgh it
name.
Error line:

For Each oSubitem As ToolStripMenuIt em In oSubmenuItems

error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows .Forms.ToolStri pSeparator' to type
'System.Windows .Forms.ToolStri pMenuItem'."

If anyone knows how to solve this, it would be of great help

Thank you

Manek

Private Sub mkgv2_container _Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.RecorrerEstr ucturaMenu(Me.m en_principal,
mk_sqlre_2("sec _per_cat").ToSt ring)

End Sub

Private Sub RecorrerEstruct uraMenu(ByVal oMenu As MenuStrip, ByVal sOpcion
As String)

For Each oOpcionMenu As ToolStripMenuIt em In oMenu.Items

If oOpcionMenu.Dro pDownItems.Coun t > 0 Then

Me.RecorrerSubm enu(oOpcionMenu .DropDownItems, sOpcion)

End If

Next

End Sub

Private Sub RecorrerSubmenu (ByVal oSubmenuItems As ToolStripItemCo llection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems 'ERROR
LINE'|||||||||| ||||||||||||||| |

If oSubitem.Name = sOpcion Then

oSubitem.Enable d = True

End If

If oSubitem.DropDo wnItems.Count > 0 Then

Me.RecorrerSubm enu(oSubitem.Dr opDownItems, sOpcion)

End If

Next

End Sub


Jun 28 '06 #2
Thank you terry, it worked Perfectly!!!

"Terry" <Te***@nospam.n ospam> escribió en el mensaje
news:00******** *************** ***********@mic rosoft.com...
The ToolStripItemCo llection is a collection of 'ToolStripItem' not
'ToolStripMenuI tems'. So maybe something like this (and I am not sure of
this part)...

For Each oSubitem As ToolStripItem In oSubmenuItems
if TypeOf oSubItem Is ToolStripMenuIt em Then
...
The point being that a ToolStripSepera tor is a ToolStripItem but not a
ToolStripMenuIt em.
--
Terry
"Manekurt" wrote:
Hello to everyone, I have this code, that gives me an error on the marked
line. It is to make a reference to a submenuitem, to enable it thorgh it
name.
Error line:

For Each oSubitem As ToolStripMenuIt em In oSubmenuItems

error: Message="No se puede convertir un objeto de tipo = Can´t convert
the type of object
'System.Windows .Forms.ToolStri pSeparator' to type
'System.Windows .Forms.ToolStri pMenuItem'."

If anyone knows how to solve this, it would be of great help

Thank you

Manek

Private Sub mkgv2_container _Load(ByVal sender As System.Object, ByVal e
As
System.EventArg s) Handles MyBase.Load

Me.RecorrerEstr ucturaMenu(Me.m en_principal,
mk_sqlre_2("sec _per_cat").ToSt ring)

End Sub

Private Sub RecorrerEstruct uraMenu(ByVal oMenu As MenuStrip, ByVal
sOpcion
As String)

For Each oOpcionMenu As ToolStripMenuIt em In oMenu.Items

If oOpcionMenu.Dro pDownItems.Coun t > 0 Then

Me.RecorrerSubm enu(oOpcionMenu .DropDownItems, sOpcion)

End If

Next

End Sub

Private Sub RecorrerSubmenu (ByVal oSubmenuItems As
ToolStripItemCo llection,
ByVal sOpcion As String)
For Each oSubitem As ToolStripMenuIt em In oSubmenuItems 'ERROR
LINE'|||||||||| ||||||||||||||| |

If oSubitem.Name = sOpcion Then

oSubitem.Enable d = True

End If

If oSubitem.DropDo wnItems.Count > 0 Then

Me.RecorrerSubm enu(oSubitem.Dr opDownItems, sOpcion)

End If

Next

End Sub


Jun 28 '06 #3

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

Similar topics

0
982
by: Juan Irigoyen | last post by:
I have created custom control that inherits from a control type toolstrip to which I add several buttons to him, when using this control appears to me a control toolstrip but without ningun button, which I can do so that these appear in the control. Thanks.
1
6721
by: Alex Clark | last post by:
Hi all, I'm using the ToolStrip in .NET 2.0, and I can't seem to find a way to change the size of it. What I want is a toolbar the size of the IE toolbar, preferably with text below images if possible. Can anyone shed any light on how to do this? Thanks, Alex Clark
1
1906
by: trainersb | last post by:
I am trying to use the ToolStrip control in Visual Studio 2005. I create a C# Windows application & add a ToolStripContainer control to the form with top, left, bottom & right panels visible. I have docked it to fill the form. Next I add a ToolStrip control to tje top panel of the ToolStripContainer control. I add a few items to the ToolStrip (it doesn't matter what these items are). Finally I run the project. I can 'dock' the...
2
1097
by: iwdu15 | last post by:
hi, im wondering if anyone else has had this problem. Whats going on, is this: i have a tab control with 8 tab pages, each with about 10 controls. Once and awhile, my ToolStrips will just randomly disappear from the designer and runtime. I check the designer code, and the line Me.tabFiles.Controls.Add(Me.tslFile) is still there. however, the toolstrip doesnt show at runtime or design time. if i click on the component picture on the...
0
1904
by: Anand Ganesh | last post by:
Hello Everybody, I am using the ToolStrip Control in .NET 2.0. I am also using a ToolStripContainer Control. I want to know how to retain the position of the ToolStrip Control in the ToolStrip Container. For example if user drags the ToolStrip and Docks to the Bottom of the ToolStrip Container.
4
18898
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi I'm trying to create a composite control to be used on a ToolStrip, consisting of a ToolStripComboBox and a ToolStripButton. It's going to be a control used to search for text in a grid control on a WinForm. I've got it working fine on a single form but now want to reuse this functionality on other forms. Usually this would be a simple matter of creating a UserControl, however a ToolStripComboBox cannot be placed on a UserControl.
0
1139
by: Johnny Jörgensen | last post by:
I'm doing a Visual Studio Add-In, and I had added an icon (let's say "MyIcon.ico") to the project resources to use it as icon for the Toolwindow tab. Then I decided I didn't want to use that icon anyway, so I removed it and added "MyBetterIcon.ico" instead. So far so good. When I debug run my Add-in projekt, the tab shows "MyBetterIcon" as I want it to.
11
8133
by: =?Utf-8?B?RWl0YW4=?= | last post by:
Hello, I have a WinForm application. The form has one Tab Control and one ToolStrip. I would like to know what would be the best way to detect when the user is "leaving" the Tab Control and "moving" into ToolStrip. Thank you EitanB
0
2636
by: Martijn Mulder | last post by:
The ToolStrip on top of my form is to small. I want to increase its height. Simply setting the Height-property doesn't change the height, though. So I tried to place the ToolStrip in a ToolStripPanel, that does react to changes in its Height-property, and by setting the Dock-property of the contained ToolStrip to DockStyle.Fill, I expected the ToolStrip to fill the entire ToolStripPanel. Nope. See the code below, it is ready to run.
0
9498
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
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9964
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
8993
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
7517
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
5398
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...
0
5535
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
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.