By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,903 Members | 1,977 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,903 IT Pros & Developers. It's quick & easy.

Assign Property Values via String Variables?

P: n/a
Using VB.NET 2005.

I will not go into detail on a problem I can't figure out, but I will
describe it simple terms that should convey the underlying issue.

I have a class called ClassA. It has two properties, Property1 and
Property2. Both properties are string datatypes. This class is a
member of a class library.

I have some code in an application that imports the class library that
ClassA is a member of. In this code I have DIMmed a variable called
myClassA that is a New ClassA datatype. I have a string array of two
elements who values are "Property1" and "Property2". I would like to
assign values to the two properties utilizing the myClassA instance
but referring to the properties by means of the values of the string
array. Is that possible?

TIA,
Feb 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <am********************************@4ax.com>,
jo*****@home.net says...
Using VB.NET 2005.

I will not go into detail on a problem I can't figure out, but I will
describe it simple terms that should convey the underlying issue.

I have a class called ClassA. It has two properties, Property1 and
Property2. Both properties are string datatypes. This class is a
member of a class library.

I have some code in an application that imports the class library that
ClassA is a member of. In this code I have DIMmed a variable called
myClassA that is a New ClassA datatype. I have a string array of two
elements who values are "Property1" and "Property2". I would like to
assign values to the two properties utilizing the myClassA instance
but referring to the properties by means of the values of the string
array. Is that possible?


Yes. Use Reflection. See:

http://tinyurl.com/n0cp

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Feb 12 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.