How to Get Controls Bound Property value.

ChubbyArse

Member
Joined
Jun 10, 2003
Messages
19
I have a control stored as an object.
The control has a databinding, how can I get the value stored in the controls property which is bound?


This gives me the bound fieldname:
ctl.DataBindings.Item(0).BindingMemberInfo.BindingField().ToString

This gives me the bound property:
ctl.DataBindings.Item(0).PropertyName.ToString


But I cant figure out how to get the VALUE of the bound property?

Thanks
 
youll need to check syntax but it should go something like this..
Code:
Dim strProp as String
strProp = ctlDataBindings.Item(0).PropertyName.ToString()
Dim typ as Type = GetType(ctl)
Dim propInfo as PropertyInfo = typ.GetProperty(strProp)
If Not propInfo Is Nothing Then
    Dim objVal as Object
    objVal = propInfo.GetValue(Nothing, Nothing) 
End If
 
Back
Top