Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Setting a Public Property with a variable.
I have a Class with several properties called Priority1, Priority2,Priority3....thr
ough Priority11 Each has a Get/Set construct
Public Property Priority1 As Integer
Set(value As Integer)
pPriority1 = value
When saving from my code behind, I want to set the property with a variable something like this:
For i = 1 To 11
ti = "txtPriority" & i
Dim li = "Priority" & i
tb = DirectCast(RowItem.Cells(1
lRefactoring.li = tb.Text **** This is the line that is not working
Is there anyway to set the property with a variable?
Thank you for any help.
8/22/2022 - Mon
use this function to set object property by its name:
sedwick: Do I only need to set the PropertyName parameter?
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Be aware that the method overload of
. You will need to pass the name of the property to the
variable exactly how it is written (with respect to character casing) in your class; otherwise, the property will not be found.
The first parameter to that function is the instance of the class for which you want to set a value on its property (e.g.
); the second is the name of the property you want to set; the third is the value you want to set for that property.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
Thank you. I have it working now. Much appreciated.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent