I believe that is the answer for every feature in .NET. I've looked at Whidbey... It's nice, sure... Has some new controls that are fun. But so far Whidbey, Longhorn, and Yukon are supposed to be the 3 greatest tools ever invented. =)
They said the same thing about XP, now is FX, my curiousity is, what will it be after FX, I can't even think of creative names to use anymore.
I think it should be called.. Herfried.
Yeah, ... we'll have it "Maybe in Whidbey" ?!?!?
I gotcha... Same thing could be done in JavaScript with the eval statement I believe... I remember doing something like this a couple times, just didn't know it was called derefrencing. Thanks for the pointer though!
-CJ
Hi CJ,
Until a couple of years ago I was a Coldfusion developer (up to v4.5).
In CFML there was a function 'Evaluate(Expression)'.
Lets say you have a structure 'Language_Enu' and 'Language_Nl'
Both would have the same 'member variables', like eg 'SaveAndClose'
To retreive the value of 'SaveAndClose' you could then set eg a current_language_variable cLang (String) scoping the entire application. So you could fetch your var like:
Evaluate("Language_" & #current_language_variable# & ".SaveAndClose")
giving you the right value for the right language.
Since CFML (at that time) wasn't OOP, this only worked for Variables (I think -> long time ago!)
If I'm right, this type of operation is called Dereferencing.
Now I'd like to retreive properties of controls having practically the same name. Instead of writing numorous nearly identical lines of code, I thought I could use this principal.
If this is not possible in vb.Net, I will use Herfrieds' solution and create the Hashtable dynamically by scanning recursively through the forms-controlcollection.
Maybe you have got another idea / approach.
Kind regards,
Michael
Are you trying to create a textbox control from a string variable as the name? I don't quite understand what your trying to do, but would be curiuos to learn what dereferencing is.
-CJ
Hi,
How would I handle Dereferencing in vb.Net 2003.
Something like:
Dim txt As TextBox = DirectCast("txt" & someStringVariable, TextBox)
This sadly won't work because a type of string cannot be casted to a textbox.
The "txt" + someStringVariable concatenation would represent a valid name of a textbox on the form.
Thanks for any ideas,
Michael