Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 27, 2012 07:32 AM by bin hex
Apr 27, 2012 06:56 AM|LINK
I have an member variable. i want to assign the variable to properties.
my work is the end user enter the value that value is assign the member variable that member variable ia assign to properties with using of class. can any one give me a sample code?
Apr 27, 2012 06:57 AM|LINK
propertyName = memberVariableName;
If this is not what you want can you show us the code that you have so far and where you are stuck?
Apr 27, 2012 07:03 AM|LINK
here is the sample for customerid
Private StrCustomerId As String = ""
Public Property CustomerId() As String
Set(ByVal _CustomerId As String)
StrCustomerId = _CustomerId
assign it to property like this
Apr 27, 2012 07:07 AM|LINK
It might be best to stick to C# in your answers. Someone who asks a question this simple is unlikely to be able to do the VB to C# conversion.
Apr 27, 2012 07:32 AM|LINK
I think C# Reflection will be the best solution to you...
You should have possible member variables in your class...Then you can search for particular variable that user enters using Reflection and assign the value to it...
var type = typeof(YourClass);
System.Reflection.PropertyInfo field = type.GetProperty("PropertyName", BindingFlags.Public