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 / Languages / VB.NET / November 2006

Tip: Looking for answers? Try searching our database.

Create Property on the fly

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marc Robitaille - 30 Nov 2006 05:22 GMT
Hello,

Is it possible to add a property to a class on the fly? If yes, How can I do
this or where can I find an exemple?

Thank you

Marc R.
Cor Ligthert [MVP] - 30 Nov 2006 05:39 GMT
Marc,

A (non static) class is a *template* that you use at design time, so what do
you mean with "on the fly"?

Cor

> Hello,
>
[quoted text clipped - 4 lines]
>
> Marc R.
Marc Robitaille - 30 Nov 2006 06:11 GMT
Hello Cor,

In my project, I need to create an Enum of a list of files and create a
property from my enum at runtime. I have already found a peace of code to
creates Enum on the fly at runtime but nothing on properties

Thank you

> Marc,
>
[quoted text clipped - 11 lines]
>>
>> Marc R.
Robinson - 30 Nov 2006 09:26 GMT
I suspect you don't *need* to create the enum of files but if you told us
more about what you are trying to do we might be able to suggest a better
way.
Phill W. - 30 Nov 2006 12:15 GMT
> In my project, I need to create an Enum of a list of files and create a
> property from my enum at runtime.

[IMHO] No; you don't.

There are plenty of ways of doing .. whatever it is you're actually
trying to achieve .. without creating new Types at run-time.  Whilst
it's /ever/ so clever that VB can do this, it's a Pain in the Proverbial
to try and work out what happened when it [inevitably] goes wrong.

Since you're working with files, I'd suggest a property that is indexed
by /file name/ as a starting point, probably derived from some sort of
collection base class so that you can iterate through them.

HTH,
   Phill  W.
Robinson - 30 Nov 2006 12:55 GMT
Yes, I was thinking "Dictionary" ;)

>> In my project, I need to create an Enum of a list of files and create a
>> property from my enum at runtime.
[quoted text clipped - 12 lines]
> HTH,
>    Phill  W.
lord.zoltar@gmail.com - 30 Nov 2006 14:48 GMT
> Hello Cor,
>
> In my project, I need to create an Enum of a list of files and create a
> property from my enum at runtime. I have already found a peace of code to
> creates Enum on the fly at runtime but nothing on properties

Just curious, where did you find that code? I don't really need it but
it sounds like a neat trick, and I'd like to see how it works. ;)

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.