Combobox in unbound mode


Author
Message
Thomas Holste
Thomas Holste
StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi there,

I use a combobox in unbound mode and populate the dropdown-part by using a business-object. When I now call the form, instead of a blank value in the entry-part of the combobox, I always get the first entry of the "dropdown-part-bo" as a already given value. What can I do to prevent this?

Best regards

Thomas
StrataFrame Team
S
StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
That is the default behavior of the ComboBox; when it has items, it does not allow a selection that is not included in the data source.  We added the TopMostItem property specifically to allow for this.  Set the TopMostItem.Description and .Value to the desired values.  It forces the item to show up as the first item in the drop down.  
Thomas Holste
Thomas Holste
StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ben,

<<That is the default behavior of the ComboBox; when it has items, >>

just to be sure to understand it. My combobox has no bindingfield and no businessobject set but the populationtype-property is set to businessobject and the populationdatasourcesettings are set to BO, its fill-method and its fiields.

So "items" does also means this?

Thanks and best regards

Thomas

 

 
StrataFrame Team
S
StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)StrataFrame Developer (6.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yes, when you set the DataSource/DisplayMember/ValueMember of a ComboBox or ListBox (which is what SF does when you populate through the business object), the control uses those values to populate its Items collection.  

What I meant by default behavior is that when you have Items in the ComboBox and it's set to the mode of DropDownList, it has to have a selected value if it's not bound.  It won't let you "select none."  It always wants to select an item when the form opens up.  You might be able to jack with it if you set the SelectedValue to null/Nothing, but it's easier to just put a TopMostItem in the list so that the users can have a way to "deselect" the items in the list or "select none."

We generally have a TopMostItem of "<none>" with a value of 0 or null, or "<please select provider>" with a value of 0.
Thomas Holste
Thomas Holste
StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)StrataFrame User (418 reputation)
Group: StrataFrame Users
Posts: 144, Visits: 618
Hi Ben,

again thanks a lot for your advice.

Best regards

Thomas
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search