ListBox.ValueMember always returns "value"


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm trying to use your ListBox control (winform) and when I access the ValueMember property, the value is always "value". I have it setup to CopyDataFrom() and have set the ValueMember in the PopulationDataSourceSettings. It is hitting a business object that is correctly populated. How do I get the current value for the selected item within the list?
Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Oops. Sorry. Posted this reply to wrong topic!



However, on the original topic, the ValueMember sets the column that the SelectedValue property returns at runtime (not the Tag property). It's right there in the help file! DOH! Anyway it is working fine now.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
After looking at your sample a little closer, there is a workaround which will save us both some time.  If you take the exact same test and have it bound to data, it works.  Also, if you set the RawText property through code, it works.  The only time there is an issue is when the Text property is set within the designer.  So, to work around the problem, just set the RawText property in code or bind the control to a business object field and this will resolve the behavior you're encountering.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Cool. I set RawText via code and it works! This is much more realistic usage in any case (or binding to data).
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Exactly...that is why we had not yet run into this Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Greg McGuffey - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
Trent L. Taylor - 19 Years Ago
                     Oops. Sorry. Posted this reply to wrong topic!

However, on...
Greg McGuffey - 19 Years Ago
                         After looking at your sample a little closer, there is a workaround...
Trent L. Taylor - 19 Years Ago
                             Cool. I set RawText via code and it works! This is much more...
Greg McGuffey - 19 Years Ago
                                 Exactly...that is why we had not yet run into this :)
Trent L. Taylor - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search