VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,564 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
dim x as string="abc"
//I want to get or set the property using the string x, how to do?
Public Property abc() As Boolean
Get
Return true
End Get
Set(ByVal Value As Boolean)
If value=true Then
.....
End If
End Set
End Property
Try something like this:
Dim p = obj.GetType.GetProperty(x)
' Getting value: '
Dim value As Boolean = CBool(p.GetValue(obj))
' Setting value: '
p.SetValue(obj, some_new_value)
where obj is the object that contains this property.