Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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 can't figure out how to get the VALUE of the bound property?

 

Thanks

  • Leaders
Posted

you'll need to check syntax but it should go something like this..

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

--tim

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...