combobox

Forcing a combobox to “dropdown” above instead of below

旧城冷巷雨未停 提交于 2019-12-23 02:22:09
问题 When you click on the "dropdown" button of a combobox, the dropped down listbox appears below the combobox, unless there is not enough space below, in which case the listbox appears above . Now I wonder if there is a possibility to force the lisbox to appear above the combobox, even if there is enough space below. Illustration When I click on the combo box, I'd like the "drop down" list box appear always above as on the left screen copy. 回答1: Everything is possible, and you don't need to

How to Create a Dynamic Variable Name for an Array?

谁说我不能喝 提交于 2019-12-23 02:17:28
问题 I have "ComboBox1" with entries in it. Every time the user selects an entry, the following is triggered: Private Sub ComboBox1_Change() call populate(ComboBox1.ListIndex) End Sub The function "populate" has the following: Sub populate(index as integer) dim arr0, arr1, arr2 ... arr0 = Array(...) arr1 = Array(...) arr2 = Array(...) Do While x < Application.CountA("arr" + index) ... Loop End Sub I want to make "arr" + index dynamic so it calls the proper array based on the index recevied from

Custom ComboBox Column for DataGridView

拈花ヽ惹草 提交于 2019-12-23 02:07:27
问题 We have a Custom ComboBox working on a form that displays some shapes instead of text. To do that all I had to do was to override the OnDrawItem function and it displays what we want. Here is a snippet for reference: protected override void OnDrawItem(DrawItemEventArgs e) { base.OnDrawItem(e); e.DrawBackground(); if (e.Index >= 0) { Brush brush = new SolidBrush(Color.LightGray); int size = this.Height/2; int origenX = e.Bounds.X + 1; int origenY = e.Bounds.Y + 3; System.Drawing.Drawing2D

BindingList with my class populating a ComboBox using a property of it?

眉间皱痕 提交于 2019-12-22 22:59:12
问题 I have a BindingList with my class where I would like to populate a ComboBox using a property of it so when my list changes the ComboBox would change as well. public class UserAccess { public override string ToString() { return Access; } public int AccessId { get; set; } public string Access { get; set; } public List<string> Command = new List<string>(); public bool HasCommand(string cmd) { return this.Command.Any(x => x == cmd); } } public BindingList<UserAccess> accessList = new BindingList

entries get data from combobox selection using tkinter and python

こ雲淡風輕ζ 提交于 2019-12-22 21:06:11
问题 yesterday I had a problem with a combobox selection which can be seen at the following link: from combobox selection different result in multiple labels using tkinter,python. unfortunately I could not be able to express my Idea,so, my problem could not be solved, anyway, thanks for your kind help. What I really mean it is expressed by the following code, the problem is that this one is using a listbox instead a combo box. Can you help me with this problem?. Thanks in advance. Héctor Here is

Default combobox first item mixed with database results

[亡魂溺海] 提交于 2019-12-22 18:49:08
问题 public static void fill_combo(string table, ComboBox cmb, string columns) { ds = new DataSet(); try { conn.Open(); da = new SqlDataAdapter($"SELECT {columns} FROM [{table}]", conn); da.Fill(ds, table); cmb.DataSource = ds.Tables[table]; cmb.ValueMember = ds.Tables[table].Columns[0].ToString(); cmb.DisplayMember = ds.Tables[table].Columns[1].ToString(); cmb.SelectedItem = null; cmb.Text = "Select..."; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } finally { if (conn != null)

How to make combo box auto expand on mouse hover and close when the mouse leaves combo box in c#? [duplicate]

筅森魡賤 提交于 2019-12-22 18:36:11
问题 This question already has answers here : Winforms: how to open combobox properly? (5 answers) Closed 5 years ago . I have a windows form. In that windows form i have a combo box. I have predefined items in the combo box as Add, Remove and Delete. I want to make the combo box auto expand on mouse hover. How can I do that? I noticed that auto expand code should be given in the mouse hover event of combo box. like this private void comboBox1_MouseHover(object sender, EventArgs e) { } but I don't

Bind text to selected item in combobox

♀尐吖头ヾ 提交于 2019-12-22 17:43:30
问题 I have a text field on the database, but now I don't want it to be a free open field, I want to restrict it to: let's say A, B and C. For this I want to use a Combobox. Question: How do I bind the selected item to the string property, given that the Items of the combobox are defined in XAML? XAML: <ComboBox SelectedValue="{Binding Path=MyProperty}"> <!-- Not working--> <ComboBoxItem>A</ComboBoxItem> <ComboBoxItem>B</ComboBoxItem> <ComboBoxItem>C</ComboBoxItem> </ComboBox> Class: public Class

Bind text to selected item in combobox

♀尐吖头ヾ 提交于 2019-12-22 17:43:03
问题 I have a text field on the database, but now I don't want it to be a free open field, I want to restrict it to: let's say A, B and C. For this I want to use a Combobox. Question: How do I bind the selected item to the string property, given that the Items of the combobox are defined in XAML? XAML: <ComboBox SelectedValue="{Binding Path=MyProperty}"> <!-- Not working--> <ComboBoxItem>A</ComboBoxItem> <ComboBoxItem>B</ComboBoxItem> <ComboBoxItem>C</ComboBoxItem> </ComboBox> Class: public Class

Disable separator selection in data bound combo box in WPF

本秂侑毒 提交于 2019-12-22 13:59:57
问题 I have a Combo Box that is databound. In this list, I need a separator. Since this is databound, I do something very similar to this post. My database returns the list, includes a '-' to mark where the separator needs to go, and the datatrigger makes this a separator. <ComboBox Name="cbAction" Grid.Column="1" Grid.Row="0" Margin="5,2,5,2" DisplayMemberPath="Description" SelectedValuePath="Code" SelectionChanged="cbAction_SelectionChanged"> <ComboBox.ItemContainerStyle> <Style TargetType="{x