views:

166

answers:

0

Hi,

I have a VB.NET website which has a static (shared) class from which I need to obtain the value of specific variables that may exist anywhere in the application's scope. The reason I have this need is that I have snippets of text coming from a database which contain embedded variable names, such as [[FirstName]]. I need to replace the string between the brackets with the value of the variable of that name at runtime. Problem is that the variable may exist in the current class, in the calling ASPX page, in the masterpage or in another static or non-static class in the project. If I know which class the variable resides in, it's easy enough to get at it this way:

Dim fieldVal as Object = GetType(MyClassName).GetField("FieldName").GetValue(New Object)

So how can I get at it when I don't know the containing class name? Or is what I'm trying to do impossible?