combobox

vb.net Bind a combobox to a datasource

允我心安 提交于 2019-12-24 12:19:52
问题 Over the past few days, I've read about a thousand forum posts, and looked at many code samples, but I still can't figure this out. My goal is to populate a combobox with values from an Access 2007 query. I can do this by using the DataSource, DisplayMember and ValueMember properties, but regardless of the data in the query, the comboboxes all just default to the to first item in the items collection and don't change when the main BindingSource is moved. I am binding the controls with this

custom combobox win32

こ雲淡風輕ζ 提交于 2019-12-24 12:06:37
问题 I am trying to implement an auto-suggest feature in an win32 combobox (C++). I want to achieve a behaviour that is similar to the google auto suggest function. When the user types something into the edit-control of the combobox, its listbox opens and shows all possible matches. The Problem is the default behaviour of a win32 combobox is to always select the closest match and put the complete text (selected) into the edit control when the list is opened. I need to avoid this behaviour. The

Cannot format given Object as a Number ComboBox

江枫思渺然 提交于 2019-12-24 11:37:15
问题 How can I set an integer number into double? Let's say I have a comboBox named day, and it has 1,2,,3 elements. I want to set it as two decimal point. If user select 1, it will become 1.00. How can I do that? public void actionPerformed(ActionEvent e){ String a=(String)comboBox.getSelectedItem(); //Integer b=(comboBox_1.getSelectedIndex()+1); int day=(Integer)comboBox_2.getSelectedItem(); double bo; DecimalFormat df = new DecimalFormat("#.##"); bo= Double.valueOf(df.format(day)); Error I get

WPF combobox search item

房东的猫 提交于 2019-12-24 10:48:52
问题 Is there any way to control the size of the interval, that is used when selected an item in a combobox via keystrokes. E.g. a combox contains {"12,"2}: Pushing 1 and quickly 2. Selects the first item in the list. Pushing 1, wait a few seconds, push 2. Selects the second item. I would like to control this interval, such that case 2 is more likely to select the first item.. Regards, Fredrik 回答1: This behavior is governed by a private property, i doubt that you can change it. // System.Windows

c# datagridview key handling

时光总嘲笑我的痴心妄想 提交于 2019-12-24 10:47:12
问题 I use DataGridView, and in some places I add control to it (e.g. textbox, combobox) dataGridView1.Controls.Add(comboBox); comboBox.Focus(); The problem is that using this control, and than commiting choice by using ENTER cause the DataGridView to "handle" the key -> after clickng enter instead of choosing sth from combobox, the selection in datagridview changes( moves to next cell). I use sth like : public class MyDataGridView:DataGridView { protected override bool ProcessCmdKey(ref Message

ComboBox with multiselect Feature in GXT

你。 提交于 2019-12-24 10:45:31
问题 I am trying to implement a comboBox with multi-select feature. There will be a checkBox associated with each of the string and user can select one or many from the list. In GXT 2, we had CheckBoxListView which makes things easier. I had follwing idea of implementing it. Using a Grid which can have one column as CheckBox and other column as the string that i wnat to display and then adding the store of this grid to the CheckBoxStore. But, as the ListStore of Grid and ComboBoxes are not same, i

Why is the combobox doubling its items when being created?

筅森魡賤 提交于 2019-12-24 10:37:23
问题 I'm creating a combobox programmatically as follows: var cbo = new ComboBox(); cbo.HandleCreated += (s, e) => { cbo.DataSource = mylist; }; When I do the above, the combobox displays double the items contained in the list. However, when I do the following, the combobox displays the correct number of items: var cbo = new ComboBox() { DataSource = mylist }; Why does this happen? 回答1: Reason The HandleCreated raises just once. the problem is something else, it's because of the way that

Using a databound combobox on a datagrid

こ雲淡風輕ζ 提交于 2019-12-24 10:36:37
问题 With a datagrid, I want to use a databound combobox to set the value of a property with the combobox's selected value. How would I go about doing that? Cheers 回答1: This can easily be achieved using the WPF DataGrid's CellTemplate features: <DataGrid.Columns> <DataGridTemplateColumn Header="My Column"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding MyBoundField}"/> </DataTemplate> </DataGridTemplateColumn.CellTemplate> <DataGridTemplateColumn.CellEditingTemplate

.Net: how can I have a combobox with multitple fields of its data source as Displaymember?

荒凉一梦 提交于 2019-12-24 10:19:42
问题 How can I have a combobox with multiple fields of its data source as its display member without adding additional columns to its data source? I mean I wanna to have a combobox with displaymember like "ID" + "-" "Name" . 1 - Black 2 - White 3 - Red I DO NOT want to add additional column to its data source. Thank you 回答1: Binding to multiple properties is not supported (in WinForms). You have to extend your DataTable with a computed column and bind to this new column. dataTable.Columns.Add(

C# WPF Combobox TextElement.Foreground Binding

…衆ロ難τιáo~ 提交于 2019-12-24 10:18:23
问题 I wish to link the TextElement.Foreground property of my combo box to the variable : "ALV_COULEUR" of my object : "tValeur" . I note in output that it does not find variable ALV_COULEUR ... System.Windows.Data Error: 40 : BindingExpression path error: 'ALV_COULEUR' property not found on 'object' ''Attribut' (HashCode=35307513)'. BindingExpression:Path=ALV_COULEUR; DataItem='Attribut' (HashCode=35307513); target element is 'ComboBox' (Name=''); target property is 'Foreground' (type 'Brush')