Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Object name on properties and code is different

Posted on 2006-07-09
6
Medium Priority
?
246 Views
Last Modified: 2010-04-16
Hi,

I'm new to c# and I noticed that when the name of an object is changed in the properties, the code does not get updated automaticaly.  Even when I double-click on the object to create new code, the old object name is used in the code.  Why does it not update automatically.  It is difficult to build and run the code as a result.  This sounds like something trivial that I can't figure out.  Any explanations or answers?  Thanks.
0
Comment
Question by:skip1000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Expert Comment

by:martin75a
ID: 17071538
Changing the name of an object in the properties pane will not change the name of already created events.

If for example you create a button named button1, and then create an event by double-clicking on it, the event will be named button1_Click.

If you later change the name to buttonOK you have to go to the properties pane and click on the button that looks like a flash to see the events, there you can rename the event as well.
0
 

Author Comment

by:skip1000
ID: 17072088
Hi martin,

The trouble is that even when after I rename the object in the properties, creating a new event for the property will still show the old name.  Is it because the self-generated declaration codes does not update w/ the name change in the properties?  Thanks.
0
 

Expert Comment

by:martin75a
ID: 17072298
Example, put a button on a form with the name button1 and create a click event that is named button1_Click.

Then rename the button to button2. The click event will still be named button1_Click, so you have to go to the events tab in properties and rename that to button2_Click.

If you then add an event for MouseClick, it should be named button2_MouseClick.

Does this not happen for you? Which version of Visual Studio are you using?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:skip1000
ID: 17072820
Hi Martin,

I'm using vs.net 2003.  I've seen cases where button2 (after renamed) where it would appear as button1_click and other cases as button2_click.  That behavior is strange and is the reason why I'm confused.  I did not apply any service packs.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 150 total points
ID: 17078166
2003 is not that smart at refactoring.

Bob
0
 

Author Comment

by:skip1000
ID: 17079219
Ok.  Then I guess there will be no easy way to resolve this except to fix the codes if the codes don't compile.  Thx.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question