Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

(Abridged code for example purposes)

 

Class ABC

Public Property XYZObject() As XYZ

End Class

 

Class XYZ

Property SomeValue As String

End Class

 

---

 

I have a combo box where I'm setting the DataSource to an array of ABC objects. I'd like to use the SomeValue property of the XYZObject property of the ABC objects as the DisplayMember of the combo box. When I try to do this (combobox.DisplayMember = "XYZObject.SomeValue"), it doesn't recognize it as being a valid property (combo box instead shows ABC.ToString(), which happens according to the documentation when the property can't be resolved)

 

Is what I'm trying to do possible or can I only reference properties that directly belong to ABC objects?

Posted
You cannot use a sub item as the DisplayMember, add another property to ABC that returns XYZObject.SomeProperty(), and use that as the DisplayMember, that should circumvent the problem.
Anybody looking for a graduate programmer (Midlands, England)?

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...