Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / July 2005

Tip: Looking for answers? Try searching our database.

Control Code Generation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Rego - 26 Jul 2005 18:38 GMT
Sorry for the newbie question ...

I need to programatically generate code for any control.  One of my doubts
is how to identify the properties that were changed after "MyControl
myControl = new MyControl()". In other words, if the user coded

   myControl.Location = new Point(10, 10);

by programatically analysing myControl properties, I need to be able to
detect that the Location property was changed, so I will be able to
generate the following line of code:

   myControl.Name + ".Location = new Point(" +
myControl.Location.X.ToString() + ", " + myControl.Location.Y.ToString() +
");\r\n";

I need to do this for all the properties changed.
Thanks for any help.

_____
Marco
Cam - 27 Jul 2005 17:06 GMT
Not sure if this is the answer that you are looking for, but if you are
writing myControl then you can capture that the property has changed in the
set part of the property declaration:

public Point Location
{
  set
  {
     _location = value;
     // add the string to some ArrayList or something here
  }
}

Or alternatively, you could have the class raise an event when each property
is modified, which could include the name of the property and the new value,
and the code in which you are creating the myControl could subscribe to it...

> Sorry for the newbie question ...
>
[quoted text clipped - 17 lines]
> _____
> Marco

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.