Click here to Skip to main content
15,887,428 members
Everything / Combobox

Combobox

combobox

Great Reads

by Christoph Buenger
Describes PHP application development with the free Scavix Web Development Framework (Scavix-WDF).
by Nilay M Joshi
Multiselect Combobox - Custom control for WPF
by Johnny J.
A sample owner-drawn ComboBox
by Er. Puneet Goel
This tip implements the TreeView like DropDownList with Search Functionality using Telerik Kendo.

Latest Articles

by vblover Programmer
Custom DropDownBox with all languages of the world to select a language.Save and reload Selected language using Application Settings
by Nilay M Joshi
Multiselect Combobox - Custom control for WPF
by AXI_IeD
How to Filter contextually the list shown by a DataGridComboBoxCell?
by César Jaramillo L.
This is an alternative for "Embedding a DataGridView in a ComboBox"

All Articles

Sort by Updated

Combobox 

13 Sep 2023 by KarstenK
You should use a more structural approach and use some data model for your combobox. Like an array of strings or suitable objects. This model can you than search or modify and than make a complete reload. Learning about the guts of the MFC is...
13 Sep 2023 by Inczu
I want to create in MFC App a combobox void CSecondDlg::ComboExistUser() that adds users and groups from any folder -> properties -> security -> edit -> add -> advanced -> search now -> search Results. If some user or group is added previously,...
13 Sep 2023 by Inczu
I want to create a code that will find if the password "xsw2!QAZ" in edit control void CSecondDlg::EdtFirstPassword() is correct when you select radio button void CSecondDlg::RadIsntExist() and then select user "Test" from combobox void...
7 Sep 2023 by KarstenK
You need to use the debugger. The most common case for your error, is that the control isnt correctly connected with some resource in the rc and wiward. ASSERT(::IsWindow(m_hWnd)): means that this object hasnt a window handle. So debug to find...
7 Sep 2023 by Rick York
Your problem seems obvious because the message told you what it is : Quote: "Debug Assertion Failed!" "Services.exe has triggered a breakpoint." on line 628 { ASSERT(::IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, BM_GETCHECK, 0, 0); } in...
6 Sep 2023 by OriginalGriff
We can't tell, we have no access to your code while it is running, so we have no idea what is in m_RadIsntExist or what it should contain. So, it's going to be up to you. Fortunately, you have a tool available to you which will help you find out...
29 Aug 2023 by Rick York
The previous solutions have given information with useful references. I will point out a very, very handy method of the CComboBox class. That is SetItemDataPtr. If this were my problem, I would first assemble the collection of users, and then...
29 Aug 2023 by Richard MacCutchan
Your time would be better spent studying the documentation for the CComboBox Class | Microsoft Learn[^]. It is a simple matter to use one of the Findxxx methods to checlk if an entry already exists before adding it to the list.
29 Aug 2023 by merano99
I guess this is asking for a way to list users and rights groups via the Win32 API. One possibility would be this: Enumerating Users: Enumerating Users - Win32 apps | Microsoft Learn[^]
13 Aug 2023 by OriginalGriff
There are two paths involved here: Dim con As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\Database1.accdb") And cryRpt8.Load("E:\Final Book purchasing System\Final Book purchasing System\CrystalReport63.rpt") Most...
13 Aug 2023 by Member 15947161
Hi, Im new to the vb.net and crystal report. i wrote a code to generate cryatal report based on the combo box filtering values. Ex:- I have two combo box named combo 1 and 2 to filter year with committee no. then it should display relevant report...
13 Aug 2023 by Richard MacCutchan
"Invalid report file path" The message suggests that it cannot create the report on the filename you have selected. So check the drive and path are valid.
2 May 2023 by OriginalGriff
Repost: Deleted. Please do not repost your question; use the Improve question widget to add information or reformat it, but posting it repeatedly just duplicates work, wastes time, and annoys people. I'll delete this one.
25 Apr 2023 by Richard MacCutchan
See ComboBox.AutoCompleteMode Property (System.Windows.Forms) | Microsoft Learn[^]. My apologies, try CB_FINDSTRING message (Winuser.h) - Win32 apps | Microsoft Learn[^]
25 Apr 2023 by Avtem
So, many WinAPI controls have a very useful feature - you can select an item in Listbox, ListView, Combobox by typing first several letters. You can try it out: just open your windows calculator, hit Ctrl+U to enable converting units view and in...
18 Apr 2023 by Member 11400059
Hi in my C# windows form project, My datagridview have one ComboBox column. this combobox items read form database and each Row Combobox have different Items. But all of the Row combobox always have same items. how can fix this? please help. my...
18 Apr 2023 by Richard MacCutchan
foreach (var item in list) { categoryName.Clear(); You are using the same list for each row of the DataGridView, so each combo will contain the same data, which is the last set that you process. You should create a new list at the start...
18 Apr 2023 by Richard Deeming
You've declared the categoryName list outside of your loop. Every row is bound to the same list of strings, and you add the categories for all rows to that one list. Since you clear the list at the start of each iteration of the loop, the list...
18 Jan 2023 by Graeme_Grant
Here is a working example for you... 1. MainWindow XAML:
18 Jan 2023 by Member 15061773
I have a WPF application where I use many ComboBox controls. Most of the time I save application user settings in the Settings file, though many people use JSON to do that work but I think the default Settings file in WPF application is provided...
16 Jan 2023 by vblover Programmer
Custom DropDownBox with all languages of the world to select a language.Save and reload Selected language using Application Settings
4 Jan 2023 by Graeme_Grant
Your outputColumns class does not have a collection to track the selections in the ComboBox (for each row), rather you only have a global collection (for all rows) on the ViewModel. This is why all rows show the same selections in the ComboBoxes....
4 Jan 2023 by EstKells
I have an an DataGrid in which I load Data from an ObservableCollection and each row has an CheckBox so that I can have a list of checked Rows. Now I wanted to add an new Column to the DataGrid which is an ComboBox and in the ComboBox is a list...
20 Nov 2022 by Graeme_Grant
Here is a step-by-step tutorial YT video on how to use a ComboBox: C# Tutorial - How to use a Combobox in C#.NET | FoxLearn - YouTube[^]
20 Nov 2022 by ernteSKY
Can somebody help me please? Binding a list into a ComboBox from a Database table with game names. When the user selected one of the list in the ComboBox then save after not storing only this data. Still empty this selected item. The following...
22 Oct 2022 by Member 15061773
Hi there, I have a simple WPF application where a different window will open if I select the last item of a Combo box. my code is working successfully but there some issue on my code. I want some more functionality. Suppose, I select the last...
3 Sep 2022 by mojtabahakimian
I am using C# WPF and currently, I am loading some data from the database in Datagrid. I loading more than 24,000 rows from a table in the database into DataGridComboBoxColumn, the problem is that when I open the Combobox it is very slow so it...
2 Aug 2022 by CIDEY
It is necessary to implement a table (DataGrid), which is initially empty. It has 2 fields: The current date and the item selected from the ComboBox. How to refer to ComboBox'u if it's impossible by x:Name'u? Here is an code: plusBtn.Click +=...
2 Aug 2022 by Gerry Schmitz
How to: Find ControlTemplate-Generated Elements - WPF .NET Framework | Microsoft Docs[^] https://stackoverflow.com/questions/8126700/how-do-i-access-an-element-of-a-control-template-from-within-code-behind[^]
31 Jul 2022 by Member 15700998
I have simple combobox and trying to search items in the dropdown list without filtering. When I upload the text it should highlight the best guess (the one which starts with the letter in the cmbtext etc.). For example there are 'ABC' and 'DEF'...
7 Jul 2022 by AmirSina Mashayekh
Hello. I'm creating a windows program (Visual Studio - C#) to communicate with AVR MCU using serial port. I want to show available serial ports in a ListBox (or combobox) and update the list immediately when a new device is available or a device is disconnected. Currently I use a "Refresh"...
7 Jul 2022 by joseph wind
public List getCommPorts() { List devices = new List(); string[] ports = SerialPort.GetPortNames(); foreach (string portName in ports) { SerialPort...
24 May 2022 by mathew_ronu
Dear, I am working on a project where I need to fetch "Id" from a stored procedure as a checkbox and pass the value to Grid view. The code below is working fine if i select a single checkbox. but when i select multiple it will only show me the...
24 May 2022 by Richard Deeming
The CheckBoxList1.SelectedItem property will return either the first selected item, or null if no items are selected. Thus if you select multiple items, you will only ever display the details for the first selected item. And if you deselect all...
1 Apr 2022 by dejf111
Good day, does embedding in ComboBox in ProWindows work the same as in Windows Form? Because I try to store values ​​(string) in the ComboBox menu but it always throws me a message: System.InvalidOperationException: 'The calling thread cannot...
1 Apr 2022 by TheRealSteveJudge
If ArcGIS is using WPF then you must change your code like this:Application.Current.Dispatcher.Invoke(() => { comboBox.Items.Add(name); }); BTW: WPF is different from Windows Forms! Please read this: Difference between WPF and WinForms -...
1 Apr 2022 by Tony Hill
It is already telling you the problem. System.InvalidOperationException: 'The calling thread cannot access this object because a different thread owns it.' You are trying to access the combobox from a different thread that created it, the...
15 Mar 2022 by ernteSKY
I filling up ComboBoxes with enums and pass the collected data into my DB manager class like this: (CountryOfEarth)Form_Animals_Add_Country.SelectedIndex But how to do it if the data is not from enum otherwise from the database? I mean just...
14 Mar 2022 by RickZeeland
See example here: Fill ComboBox From Sql Server On C#[^] And if you have the time, study this CodeProject article: A Detailed Data Binding Tutorial[^]
14 Feb 2022 by Blue Ocean
For all who are interested in the final solution that spanned two different questions, go here: https://www.codeproject.com/Questions/5325114/How-to-concatenate-a-multiple-field-combobox-selec
14 Feb 2022 by Blue Ocean
I have a very simple project in Visual Studio 2022 using Winforms C# SQLite, that includes a combobox that selects from sqlite database. Based on the selection in the combobox, the datagridview is filled with data from another table. When my...
14 Feb 2022 by Blue Ocean
OK, with everyone's guidance I seem to have worked most things out now. I still have one issue that evades me. Here is my cleaned up code that seems to work great so far, with the one exception: using System; using System.Data; using...
11 Feb 2022 by M Imran Ansari
That's correct, you are providing Insufficient parameters, check the below line you are providing control name as @Car_ID parameter not the selected value: sqlite_cmd.Parameters.Add("@car_ID", System.Data.DbType.Int16).Value = autoidcomboBx;...
16 Jan 2022 by MXwell8
Hi, I have a little issues, while auto-refresh all values (remaing time), in summary the program pick the datatime stored in a combobox then subtract it with current time (datetime.now) and return the value (remaining time) stored in another one...
16 Jan 2022 by Luc Pattyn
Hi, your ComboBox3.SelectedIndex = i is not doing anything useful. Your Dim parsedate As DateTime = ComboBox2.SelectedItem.ToString will give the same result on each iteration of your loop, and all items in ComboBox3 will end up showing the...
16 Jan 2022 by MXwell8
Hi, I have a issue, after a lot of tries and errors this is the final code, I also inserted a comment for each line to know about the structure of what I like to achieve in summary an auto-refreshing of all stored datetimes (with old timestamp...
16 Jan 2022 by Luc Pattyn
The custom datetime format string "hh:mm:ss" will fail when hh is not in the range [01,12]. What you most likely need is "HH:mm:ss" which accepts [01,24]. See Custom date and time format strings | Microsoft Docs[^]
6 Jan 2022 by User 13045643
Hi all, I have created an Event handler to a function for clicking a generated button, now when this button is clicked need to paste in a textbox the Combobox.seleteditem (that it's a string. Each generated one (Combobox, textbox, button) will...
6 Jan 2022 by User 13045643
More than a solution it's a workaround 1)I changed the btn.click to cbx.selectedindexchanged but it will be instantly pasted into the textbox but have the same result except for the click (I'll wait for some other solution) 2)Make for some ...
28 Dec 2021 by Luc Pattyn
How about ComboBox2.SelectedIndex = ComboBox1.SelectedIndex instead of your for loop?
28 Dec 2021 by User 13045643
Hi all, I have a question, how can I make during a selectedindexchanged of a combobox make the other one the same index? Because I have to make sure that when selected a index it became the same (not value but index). I was thinking of an if...
28 Dec 2021 by User 13045643
I found out a solution that seem working it's this, if anyone needed or may give some help. Thanks anyways rivate Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged For i = 0 To...
7 Dec 2021 by wolfsor
I have populated the combo box with data from a database and I wanted to remove the duplicate names from the combo box items list. Can you give me a code to do it?
25 Oct 2021 by Member 10696161
I'm writing app which can not only generate barcode from combobox but will scan barcode into textbox. Generating barcode is working well but is a little worse with scanning it by Device Zebra DS3608. In this project I added a library: using...
25 Oct 2021 by OriginalGriff
You would need to contact the author of your library and check with them: it isn't a standard part of .NET. If they are unhelpful, then you will have to process scanner input yourself. Most scanners come set to act as a keyboard, and there is no...
6 Oct 2021 by Devendra Sarang
I have 1 grid view. On gridview cell click, it will show relavant data in another gridview. Now another gridview has DataGridViewComboBoxColumn Its data is loading but is is showing when i click on it. Bu default it is showing blank. Like...
6 Oct 2021 by mirajanata
This is binding problem, maybe this helps: cmbContactsName.DataSource = dt2.DefaultView; instead of cmbContactsName.DataSource = dt2;
6 Oct 2021 by CHill60
Try this order instead - it's the setting of DataSource that I've moved to after the ValueMember and DisplayMembercmbContactsName.ValueMember = "ContactsID"; cmbContactsName.DisplayMember = "Contact"; cmbContactsName.DataPropertyName =...
5 Oct 2021 by mirajanata
Try just cmbContactsName.ValueMember = "ContactsID"; cmbContactsName.DisplayMember = "Contact"; cmbContactsName.DataPropertyName = "ContactsID"; P.S.: "FirstName" is not a member of query column list, you can't address it as a DataTable...
26 Aug 2021 by dj4400
Hi Sorry in advance for the long question ... I'm using C# winforms on my app. I have 2 combo boxes (id and type) and 1 textbox (name) that are bind to a data that represents an item in a list Changing the 1st combo box (id) - changes the...
26 Aug 2021 by dj4400
I found a solution: The comboBoxType binding should be declared like that: //Clicking the combo box now shows all the enum values comboBoxType.DataSource = Enum.GetValues(typeof(EnumItemType)); //the selected item of the combo box now...
7 Aug 2021 by Avtem
So i need to handle any change in a WinAPI combobox (its' type = Simple (you can modify the entry in edit box)). Everything is fine, except it always prints previous text, not the current. void onCommand(WPARAM wparam, LPARAM lparam) { ...
7 Aug 2021 by Richard MacCutchan
You should study Combo Box (Windows Controls) - Win32 apps | Microsoft Docs[^] which explains how to use the control.
5 Aug 2021 by BillWoodruff
First, realize that the CheckedListbox is kind of an old fossil Control that does not offer the binding goodness of newer controls: [^]. You may find that setting the DataSource of a CheckedListbox in a standard way suddenly throws errors: [^] ...
5 Aug 2021 by Will Sewell
I'm looking to declare an enum in a separate class called "workhours" and then use a checked list to allow selection of these days. I'm then using a "calculate total hours" button to total up the result in a label. Here are some screenshots: ...
3 Aug 2021 by OriginalGriff
Quote: My problem is that I get an exception unhandled And the problem we have is that we have no idea what exception, or where - we can see two lines of code that may or may not be related, and a image of an enum (instead of teh actual code...
2 Aug 2021 by Will Sewell
Label placement c# winform - Album on Imgur[^] The first picture is when I launch the program, the second is in the designer. I would like to know what is the best way to have it so the combo boxes and textboxes don't overlap. What I have...
2 Aug 2021 by Maciej Los
Seems, that Anchor property has been messed up. I'd change that property for Combobox and TextBox to: Top, Left
31 Jul 2021 by Adérito Silva
To check if a value is inside a collection or not, you will always need to perform some check. In this case, you need a collection that can check for a unique value very fast. What you need is a HashSet collection, which uses binary...
31 Jul 2021 by Member 13707743
I'm using C# WPF I have Combobox in my project and that will fill items from database my Combobox IsEditable is true it means users can type instead choosing item from list the problem is they can enter invalid item something else its not in...
24 Jun 2021 by joshrduncan2012
Can anyone help me with how to populate a combobox with data once another combobox has been selected? I'm confused as to how the selectedindexchanged events work. I am using C# with Visual Studio 2010/2012.
14 Jun 2021 by Richard!i!
I am writing a C# WPF application and following the MVVM pattern. My ViewModel has an object in it called NetworkMain My View has a DataGrid which binds to an ObservableCollection called FlowControls which is inside NetworkMain My DataGrid...
14 Jun 2021 by Richard Deeming
How about naming an element further up the hierarchy:
26 May 2021 by Nilay M Joshi
Multiselect Combobox - Custom control for WPF
18 May 2021 by Flidrip
What I'm trying to achieve: To delete a row from SQL table1 where column1 = @myParameter. Where @myParameter holds the value of my current comboBox1 selection. My ComboBox populates fine, and is bound to a DataSet. This is my code: using...
18 May 2021 by Flidrip
Thank you both for your inputs. As for why I couldn't delete any rows, I figured out what the problem was. My code that gave value to my parameter for the DELETE statement, returned: "System.Data.DataRowView" E.g. it returned the object, and...
18 May 2021 by OriginalGriff
var i = comboBox1 comboBox1.DataSource = null; comboBox1.Items.Remove(i); What on earth did you expect this code to actually do? Remove an item from itself? You do understand what a combo box list is, don't you? You don't change the ComboBox:...
15 May 2021 by Member 13755790
i have three combobox, combobox1 has preloaded list, based on what the combobox1 value will populate the combobox2. i have no errors on this, but when i try to populate combox3, it gives me "child list or field system cannot be created. this is...
24 Apr 2021 by Member 13890612
Hi everybody... I'm a beginner at asp.net webform, Can you please help me fix my problem? i have dx:ASPxGridView contain of 4 Column "productId","ProductName","Brand",and "Unit". I can get the value for 3 first column, but I need to get the item...
26 Mar 2021 by ahmedelhamahmy
Add a name to your combo select to call it easier echo ""; while($row = mysql_fetch_array($records)) { $fv = $row['descr']; echo "".$fv."";
26 Mar 2021 by Member 12027536
Here is the code to populate in COMBOBOX the contents of a MYSQL tablemysql_connect('localhost', 'root', ''); mysql_select_db('test'); $sql = "select id, descr from firm order by id"; $records = mysql_query($sql) or die(mysql_error());echo "";while($row =...
18 Mar 2021 by Ishimora1
Hi, essentially im trying to assign a value to whatever the user selects from a combobox. For example, if A is selected then value is set to 1, If b selected then value is 2 etc. The value would then be used to do a multiplication using input...
18 Mar 2021 by Maciej Los
Why to force doors wide open? Please, check this: Bind ComboBox or ListBox Control to Data - Windows Forms .NET Framework | Microsoft Docs[^] For further details, please see: DisplayMember[^] - defines what values are dsiplayed ValueMember[^]...
25 Feb 2021 by Xlance
May be it's not optimal but that's the best I could do ! var streamX02 = dialog.OpenFile(); var streamX03 = dialog.OpenFile(); var readerX02 = XmlReader.Create(streamX02); var readerX03 =...
25 Feb 2021 by Xlance
I successfully imported Background value from XML file to Textbox txtInputFileT, however I still need to import value of X0 into NumericUpDown NumericUpDownX0 and value of cmbFontSize0 to Combobox ComboboxX0 Not sure how to structure it within...
24 Nov 2020 by KK Nizami
I created a windows form, with a ComboBox, in C# with Mysql Database, the table name is accounthead from this table I want to populate only particular HeadName and its under all Sub HeadName, example Sales A/C and under all this Sub HeadName only...
24 Nov 2020 by Gerry Schmitz
You want a recursive query. sql - How to create a MySQL hierarchical recursive query - Stack Overflow[^]
21 Oct 2020 by Member 13707743
I'm using wpf c# and Entity Framework I have a DataGrid on that show data from database when users click on datagrid that row will show items in ComboBox (Load on of columns in combobox) but problem is combobox doesn't show Normal list...
8 Oct 2020 by Gerry Schmitz
You need to serialize / deserialize the "root" class; you (normally) can't serialize / deserialize just a list. var status = JsonConvert.DeserializeObject>(response); (It says so further on in the program comments).
8 Oct 2020 by programmer1010101
I am very new to visual studio. I am writing a program which will retrieve the signature of an employee from an API when their name is entered and a "Get user" button is clicked (e.g. if the employee name Jane Doe is entered, the signature "JDOE"...
14 Sep 2020 by BillWoodruff
I'm not going to write our code for you, but, I hope I can give you some ideas: 1 to fill the ComboBox with a set of nom duplicate items: // dt is the DataTable // c2 is the #2 DataColumn var cval = dt.AsEnumerable().Select(row =>...
14 Sep 2020 by Ramtin992
I have database in ms access. I have connected it to C#. The user needs to select a crane type through a combobox. The moment that user selects the item in the combobox I want to have some items related to that choice in a checkedlistbox, which I...
5 Jun 2020 by Member 14854584
Linq: It own has the property of Distinct() //Some data in Linq List list = new List() { Name ="Swaraj Ambekar", Name ="Swaraj Ambekar", Name ="Swaraj Ambekar", Name = "Forbes Technosys" }; //Adding data source to...
4 Jun 2020 by greatoceansoftware
Sorry for the trouble. Found the solution: The ResourcesView used to populate the list was in use in other places in the application, and was synching all controls bound to it. So setting the IsSynchronizedWithCurrentItem=False on all the...
4 Jun 2020 by greatoceansoftware
I have the following data bound ComboBox, and it insists on automatically selecting the last item when loaded. Anyway to get it to load with nothing selected?
17 May 2020 by Maciej Los
You're using DisplayMember[^] and ValueMember[^] properties wrong way. In both cases the description is: MSDN wrote: A String specifying the name of an object property that is contained in the collection specified by the DataSource property. The...
17 May 2020 by Usarsef
I had to find out how to set values into ComboBox items So i have a combo box with two string items and each item make some changes on other combo box then savee to xml Now i tried to set value for this items but the problem is the xml output...
15 Apr 2020 by RossMW
You can define public variables or an object that you want to use in the second form as define from the first form. In your case you could pass an object (datagridrow) or the id the the row from the database or multiple values depending on what...