473,569 Members | 2,422 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting from VS2003 to VS2005

I am trying to convert code that worked in a Visual Studio 2003 project to
code that will work in a Vsual Studio 2005 project
and need help.

The following is the VS2003 code:
private void mnuColorItem_Cl ick(

object sender, System.EventArg s e)

{

MenuItem mnuItem = (MenuItem)sende r;

//Get the color name from the menu item text

//while removing the & character in that text

rbText.Selectio nColor = Color.FromName(

mnuItem.Text.Re place("&", ""));

//Uncheck all menu items inside the color menu

foreach (MenuItem m in mnuItem.Parent. MenuItems)

m.Checked = false;

mnuItem.Checked = true;

}
In VS 2005 this doesn't work because the menu is now a ToolStrip and
MenuItem is now a ToolStripMenuIt em...
But when I change that then I can't access the parent because it is
protected. I am not sure what I have to change to get at that data....
That is what I need help with right now.
Sep 20 '06 #1
3 3037
Henry,

You can use in version 2005 the same menus as in version 2003, there is no
need for the language to use toolstrips, which are of course other classes
with their own methods.

Cor

"Henry" <he*********@my quest-tech.comschreef in bericht
news:uB******** ******@TK2MSFTN GP03.phx.gbl...
>I am trying to convert code that worked in a Visual Studio 2003 project to
code that will work in a Vsual Studio 2005 project
and need help.

The following is the VS2003 code:
private void mnuColorItem_Cl ick(

object sender, System.EventArg s e)

{

MenuItem mnuItem = (MenuItem)sende r;

//Get the color name from the menu item text

//while removing the & character in that text

rbText.Selectio nColor = Color.FromName(

mnuItem.Text.Re place("&", ""));

//Uncheck all menu items inside the color menu

foreach (MenuItem m in mnuItem.Parent. MenuItems)

m.Checked = false;

mnuItem.Checked = true;

}
In VS 2005 this doesn't work because the menu is now a ToolStrip and
MenuItem is now a ToolStripMenuIt em...
But when I change that then I can't access the parent because it is
protected. I am not sure what I have to change to get at that data....
That is what I need help with right now.

Sep 20 '06 #2
I might be able to do that, but it would mean rebuilding the entire menu
system.
I am hoping that the solution is simpler than that.

It appears to be an access issue. Here is the error message:

'System.Windows .Forms.ToolStri pItem.Parent' is inaccessible due to its
protection level E:\Projects\70-316\Chapter2\St epByStep2_18.cs 74 44
Chapter2

I have tried to address this by changing the access modifier for the parent
control(s) of the specific menu items to public from private. I am still
getting the error message though.
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eg******** ******@TK2MSFTN GP05.phx.gbl...
Henry,

You can use in version 2005 the same menus as in version 2003, there is no
need for the language to use toolstrips, which are of course other classes
with their own methods.

Cor

"Henry" <he*********@my quest-tech.comschreef in bericht
news:uB******** ******@TK2MSFTN GP03.phx.gbl...
>>I am trying to convert code that worked in a Visual Studio 2003 project to
code that will work in a Vsual Studio 2005 project
and need help.

The following is the VS2003 code:
private void mnuColorItem_Cl ick(

object sender, System.EventArg s e)

{

MenuItem mnuItem = (MenuItem)sende r;

//Get the color name from the menu item text

//while removing the & character in that text

rbText.Selecti onColor = Color.FromName(

mnuItem.Text.R eplace("&", ""));

//Uncheck all menu items inside the color menu

foreach (MenuItem m in mnuItem.Parent. MenuItems)

m.Checked = false;

mnuItem.Checke d = true;

}
In VS 2005 this doesn't work because the menu is now a ToolStrip and
MenuItem is now a ToolStripMenuIt em...
But when I change that then I can't access the parent because it is
protected. I am not sure what I have to change to get at that data....
That is what I need help with right now.


Sep 20 '06 #3
I found the answer! See the code below:

It appears that the parent object is revealed by a method rather than a
property.

So the code I needed after changing to ToolStripMenuIt em types was

"mnuItem.GetCur rentParent().It ems"
private void mnuColorItem_Cl ick(

object sender, System.EventArg s e)

{

ToolStripMenuIt em mnuItem = (ToolStripMenuI tem)sender;

//Get the color name from the menu item text

//while removing the & character in that text

rbText.Selectio nColor = Color.FromName(

mnuItem.Text.Re place("&", ""));

//Uncheck all menu items inside the color menu

foreach (ToolStripMenuI tem m in

mnuItem.GetCurr entParent().Ite ms)

m.Checked = false;

mnuItem.Checked = true;

}

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eg******** ******@TK2MSFTN GP05.phx.gbl...
Henry,

You can use in version 2005 the same menus as in version 2003, there is no
need for the language to use toolstrips, which are of course other classes
with their own methods.

Cor

"Henry" <he*********@my quest-tech.comschreef in bericht
news:uB******** ******@TK2MSFTN GP03.phx.gbl...
>>I am trying to convert code that worked in a Visual Studio 2003 project to
code that will work in a Vsual Studio 2005 project
and need help.

The following is the VS2003 code:
private void mnuColorItem_Cl ick(

object sender, System.EventArg s e)

{

MenuItem mnuItem = (MenuItem)sende r;

//Get the color name from the menu item text

//while removing the & character in that text

rbText.Selecti onColor = Color.FromName(

mnuItem.Text.R eplace("&", ""));

//Uncheck all menu items inside the color menu

foreach (MenuItem m in mnuItem.Parent. MenuItems)

m.Checked = false;

mnuItem.Checke d = true;

}
In VS 2005 this doesn't work because the menu is now a ToolStrip and
MenuItem is now a ToolStripMenuIt em...
But when I change that then I can't access the parent because it is
protected. I am not sure what I have to change to get at that data....
That is what I need help with right now.


Sep 21 '06 #4

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

Similar topics

0
940
by: John | last post by:
Hi all, I have a couple of web sites I want to convert from VS2003 to VS2005 for testing and messing around with. The problem I have is that in VS2005 when I take the 'open web site' option, the conversion is absolute crap. It loses my page/usercontrol inheritance. I notice that the Page namespace is replaced with the ClientScript...
3
1789
by: Darrin | last post by:
Hello, I see that VS2005 and the new framework 2.0 is out to the public now. Wondering about some things. When you install the new framework 2.0 can a person still use visual studio 2003 or do you need to use Visual Studio 2005? If you can use the new framework 2.0 with VS2003 are there any benifits?
9
1618
by: Michael Tissington | last post by:
After converting from 6.0 to 2005 when I try to Compile my project I'm getting a LINK error Error 1 fatal error LNK1181: cannot open input file " ?/.obj" Any ideas how to fx this please ? -- Michael Tissington http://www.oaklodge.com
15
4205
by: Joseph Geretz | last post by:
OK, I'll admit it up front - I just don't get it. Here's our previous VS2003 development model. Developers develop the WS solution on their own workstations, using their own IIS web servers mapped to the local devleopment folder. Project compiles to a subfolder .\bin. To deploy, the asmx page and bin subfolder are copied to the production...
2
1546
by: Tammam | last post by:
Hello, I converted a web solution from VS2003 to VS2005. The conversion process proceeded successfully with no errors and the new VS2005 solution builds with no error. When trying to run it, the images don't show on the web page! The text boxes, writings and stff show correctly but the images don't. Your help is appreciated, Tammam
5
2211
by: Tony | last post by:
Hi all, Here's the link to the issue we were seeing on our ASP.NET system when modifying, adding and deleting directories in framework 2.0. http://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx I then tried a few of solution I found while perusing Google, - FCNMode registry mod - Relocating to App_Data folder to...
3
1408
by: Marcus | last post by:
Hi, I converted my .Net1.1 application (written in VS2003) to a .Net2.0 application. I let VS2005 do the job as it suggested when trying to load my VS2003 project in VS2005. I then included the output exe from this project into my VS2005 setup project. I used it as a custom action. I then built the whole thing and installed it.
1
1328
by: sureshhalade | last post by:
I want to migrate VS2003 Windows/Class library/console project to VS2005 Windows/Class library/console project. And the DLL out of VS2005 project should work as previously. Note: My main project contains some other 3-4 projects (Class libraries, Windows Application) in it. What I tried is - 1. Conversion of VS2003 project to VS2005 project...
0
1255
by: Academia | last post by:
I have a vs2003 solution that I want to convert to VS2005 format. These projects have been converted and now compile in VS2005. But they had the older format - they is the UI code was in .vb rather than in .Designer.vb. To fix a project file I'd create a .designer.vb file and move code from .vb to it. I also had to change the .vbproj file
1
1860
by: kphip123 | last post by:
Hi! I recently converted an application from VS2003 to VS2005. The application consists of a main 'unmanaged C++ executable' which calls a managed C++ .dll. The .dll basically launches a separate form. The application use to work fine in VS2003. Now that I have converted to VS2005 the main executable is working but an exception gets...
0
7703
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...
0
7926
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. ...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6286
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...
1
5514
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...
0
3656
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...
1
2116
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
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.