Click here to Skip to main content
15,887,135 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 

10 Feb 2011 by #realJSOP
Try this:ta = cbxGenre.SelectedText;Have you considered using the debugger?
22 Dec 2016 by #realJSOP
Try this (no guarantees): To...
2 Apr 2018 by #realJSOP
I would write a method in my dbcontext class that performed the necessary filtering, and bind the returned collection to the combo box. Of course, this would probably be pretty slow if you were filtering as the user typed something, but it's certainly doable.
1 Dec 2018 by #realJSOP
I know - it's unfortunate that you have to actually write some code, but that's how it goes. Put a try/catch block around the code that's attempting to insert the new user, and in the catch part, show a message box that shows "User name already exists.", and let that be that. At the same time.
11 Oct 2014 by 101010101
How do you code a Combo Box (Drop down link box) with a submit button in windows form application in C#, in visual studios 2013. This is what I want exactly but in c# - http://www.itechies.net/tutorials/jscript/jsexample.php-pid-combo.htmI have to save space on my application, this would...
29 Mar 2011 by 3-Sigma
If I have a dropdown style combobox, and I type in a value which isn't in the list but matches the start of a value in the list, then that value gets selected when I click the dropdown arrow. Eg If I type in 13, and 130 is in the list, then 130 is selected if I click the dropwdown arrow. Is...
11 Apr 2011 by 555336
Hello, I need help on combo box and masktextbox in visual basic.I have a combobox which has 4 items namely: product, size, cost and number
5 May 2011 by 555336
Help, I have searched many sites and found very few information on these in Visual Basic.
15 May 2010 by _T("No name")
Hi,I have made a custom combobox by overriding its DrawItem() function. I also use WM_CTLCOLORLISTBOX and getting hWnd to listbox in lParam and settting it my listbox. ListBox drawing is done in DrawItem().Now the problem is when there are many items in the listbox and a scrollbar is...
30 Mar 2011 by a1mimo
HiFrom what I understood your problem is that you use the same dataset with the same TableAdapter and BindingSource in both the DataGridViews , if this is right then here is your solution you just have to make a copy of your dataset and TableAdapter and also the BindingSource lets assume they...
16 Oct 2012 by Aarti Meswania
If you have load data in DropDownList as below,DropDownList1.DataSource = DtCategoryDropDownList1.ValueMember = "Cate_id"DropDownList1.DisplayMember = "Category"then,dropdownlist will have value as belowdropdownIndex ValueMember Displaymember0 1 Books1 ...
13 Aug 2013 by abbaspirmoradi
combobox.SelectedValuePath= "Id"; combobox.DisplayMemberPath= "Name"; combobox.ItemsSource= type;combobox.Text="Please choose an item";
19 Jan 2018 by abboudi_ammar
I find this source code that allows me Binding ComboBox directly to enum values but I do not understand this instruction public IList UserTypes { get { // Will result in a list like {"Tester", "Engineer"} return...
19 Nov 2014 by abdulsafran
Hi, I have two comboBoxes which have some duplicate values, my problem is I need to compare tow comboBoxes and need to remove duplicate values in comboBox 1 only, here is a code which express how to remove duplicates in comparing one comboBox value. Please support...
13 Sep 2012 by Abhai Oza
Just Clear Dataset or Datatabel orBind query to set order by Name. ofr eg:Select MastName,MastId from MastTabel order by MastName.
24 Sep 2012 by Abhijit Parab
Call Grid.DataBind() method after Grid.DataSource = DT;I hope this is the thing which is missing in your code
12 May 2010 by Abhinav S
This link should most certainly give an idea on how we can do this using SelectedItem in a combobox in WPF
12 May 2010 by Abhinav S
Have a look at this post.Once you have implemented an event for key stroke, you can write logic to refresh your UI based on this stroke.
4 Dec 2010 by Abhinav S
Put a debug point at the first if condition and then debug to check 1) the ta value2) whether your code goes into any of these if conditions.
10 Feb 2011 by Abhinav S
It is difficult to figure out what could be wrong without looking at the code / design that binds genres to the combo.At best, for a simple example see here[^].This might give you an idea as to what you might be doing wrong.
5 Aug 2011 by Abhinav S
You can handle the key down event on the dropdown.Based on what has been selected, you can either cancel or allow the edit.
27 Aug 2012 by Abhinav S
Assuming you are binding text to the dropdown, just add an additional row to the collection before the binding.For example, "--Select an option--". This will automatically appear on the top of the dropdown.
5 Sep 2012 by Abhinav S
Try debugging your source code and figure out which line throws the error.
7 Sep 2012 by Abhinav S
Some of the posts here[^] might help you.
16 Jan 2013 by Abhinav S
I guess what you are looking for is a cascading dropdown set. These links might help you out.http://csharpdotnetfreak.blogspot.com/2012/07/cascading-combobox-in-winforms-windows-forms.html[^]http://sathishnewworld.blogspot.in/2012/07/cascading-combobox-in-winforms-windows.html[^]
19 Mar 2013 by Abhinav S
This is not really binding - foreach (DataRow dr in dtZipList.Rows){ Zip = dr["ZIP_CODE"].ToString(); cmbDataBase.Items.Add(Zip);}You are basially doing this the 'old' way by running a loop and adding to the dropdown.Create and ObservableCollection[^] of these items and the...
27 May 2013 by Abhinav S
Should'nt the select part be Select p.Department.Department_Name?In general, debugging and stepping through your code will help you get an idea on the error.Code will break on the line you have an error.
23 Nov 2013 by Abhinav S
I guess you populate data using a query.Sort the data in this query.If you want to sort on client side, then sort the returned collection using LINQ.
6 Feb 2014 by Abhinav S
Instead of DataGridView1.Columns(0).DataPropertyName = "FAGRN"you probably need to set the DisplayMember and ValueMember properties since this is a drop down type column.
23 Feb 2014 by Abhinav S
Not difficult to do.When the user selects merchant, popupate the merchant dropdown and hide the other dropwdown.When the user loads non-merchant. load the other dropdown.
8 Jul 2014 by Abhinav S
int.Parse(TxtId.Text);This line is probably throwing an error.If you try and parse a non-integer value into an integer, you will get an error.To avoid these erros, try and use Int.TryParse[^].This can confirm if the value is an integer before parsing it into an integer variable.
11 Nov 2015 by Abhinav S
Try these links -Cascading Dropdown & Multiselect Option in ListBox Using WPF[^]http://social.technet.microsoft.com/wiki/contents/articles/17946.cascading-comboboxes-in-wpf-using-mvvm.aspx[^]
25 Feb 2013 by Abhinav_Sharma
Hello friends,I want to extract the name property from selected item and pass it to a Elements(Xname) property,but don`t know how to convert it.Actually iam working on a filter consisting of two combo boxes and a texbox. Combobox1 is populated with selectedItem`s element(from xmldata) and...
16 Sep 2010 by Abhishek Sur
You can set SelectedIndex = -1, but always remind you that when you set it to -1 even though one item will seem to be selected, you cannot get its value from SelectedItem as it will return you null.Please check SelectedItem to be null before calling any method. :rose:
3 Feb 2016 by Abrar Kazi
On SelectedIndexChanged you can write your Stored Proc code and send the data to database everytime the SelectedIndexChanges.Hope this helps.
10 Dec 2012 by ACE_
In event form load write this example codeOpen_Database() Dim Query As String = "Select StudentName from Student"Cmd = New SqlCommand(Query,Con)Dr = Cmd.ExecuteReaderWhile Dr.ReadStudentName_Cbo.Items.Add(Dr("StudenName"))End...
17 Nov 2015 by AcidUser85
I think I found a bug in DataGridView. When I select item in DataGridView Combobox only by mouse, then dirtystate event fires 2 times. First time when drop down is opened, and second time when I select an item from Combobox dropdown. I have overriden ProcessCmdKey so I can now open Combobox...
7 Nov 2013 by Adam Zgagacz
ComboBox extension methods for binding with Enum types
16 Dec 2013 by Adam Zgagacz
Here is full code. I added some comments, please read them and try to inderstand what's happening in the code:private void SelectEmployeeInfo(){ if (!string.IsNullOrEmpty(cboSelectEmp.Text.Trim())) { string input = cboSelectEmp.Text.Trim(); //Assuming your...
7 Mar 2013 by Ademaker
Hello, I'm beginner here and would like your help.The number select in dropdown don't appear in RibbonComboBox. Where I'm making mistakes?
1 Apr 2011 by adnama
Im trying to fill up a combobox with the data in a database model of wpf and this is the code im using. of course it is not working but because it is saying that columns it doesn't know what it is. even the word defaultview. please helppublic void bindcombo() { ...
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...
1 Jun 2013 by afreen_2010
I have a combobox as a dropdown showing customername and combobox for car plateno and some other controlson cmbCustomernmae leave iam settign datasource for cmbPlateno as all plateno for that customer from database.im using vb.net 2008 mssql 2005 windows app. code is as below:...
2 Jun 2013 by afreen_2010
cmbPlateNo.DataSource = dtI havent forgot that. I have already written it and Im using datatable not dataset
23 Nov 2013 by agent_kruger
try thisDataTable Dt = new DataTable();//where all data is saved to show in comboboxDt.Columns.Add("Id");Dt.Columns.Add("Name");Dt.Rows.Add("0","Stephan");Dt.Rows.Add("1","Antony");Dt.Rows.Add("2","Mike");Dt.DefaultView.Sort = "Name ASC";//This will turn your record in...
16 Oct 2015 by Ahmed Zoeil
my windows form (form1) has textbox control (textbox1) , combobox control (combobox1) which all contain items (table1 - table2 - table3) and the sql database name (database1) and it has a tables (table1 - table2 - table3)which are identical each contains columns (itemcode - itemname -...
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."";
1 Jun 2014 by akhil.krish
hi iam using crytal report if not select employee id show all record...i will write this code cryRpt.ParameterFields("@pStartDateTime").CurrentValues.AddValue(DateFrom.Value()) cryRpt.ParameterFields("@pEndDateTime").CurrentValues.AddValue(DateTo.Value()) ...
7 Dec 2012 by Albandsan
Hi everyone,First of all I would like to thank you for the great articles we can find on this web site!Well, I'm having a problem with the filter method of the binding source.My idea is to use a combo box to select the column where the filter method is going to look for the text...
8 Dec 2012 by Albandsan
It works! Thank you KrunalI've combined the "Combobox1.selectedvalue.tostring" with the "if then" statement to handle every item in my combobox1 collection and also the posibility of it being nothing.Here is what I did:Quote: Private Sub TextBox12_TextChanged(ByVal sender As...
19 Jan 2018 by Alex Schunk
Enum .GetValues(typeof(UserType)) // Get all values of the enum... This will return an array of object .Cast() // cast each object to enum UserType - This will return a IEnumerable .ToList(); // Convert the IEnumerable to a...
26 Jun 2012 by Alexander Oreshkov
FYI, there is nice auto-complete text box in WPF Toolkit (). Why don`t you use it?
23 Jan 2014 by AlexEvans
Hello,I am trying to load post codes into a combobox on my web page, from a csv file that has in it only one column per record for each post codeI am looking for an example on how to go about itThanksAlex
24 Mar 2010 by Alishah Novin
Currently, ComboBoxItems cannot be selected using the keyboard - only the mouse. This is an attempt to resolve that.
8 Dec 2014 by AlwaysLearningNewStuff
I am using a combobox control to show names stored in a database ( I need to preserve space, that is why I use it instead of a listview, for example ).My problem is that sometimes text is longer than the combobox so part of it can not be seen.Is there a way to resize combobox' listbox so...
1 Jan 2014 by amadofirst
Iam using Visual studio 2012,i would like to change text box values automatically based on fixed combo box values, meaning i have combobox with 4 fixed values & i want to change another text box values based on these changeable values.so anyone know simple method to apply that will...
30 Mar 2011 by Aman4.net
Hi, I have used a Generic DataSet (to bind two DataGridViews) containing following two tables:1. Teams2. Team MembersI have combobox (Binded with Team) in DataGridview (Team Member) Cell. When I change the combobox selection My both DataGridView get reset.However, I want to...
18 Dec 2014 by Amir Mir Motahari
dear programming talentshi i Need urgent help to create a folder with the name of the combo box and text box values in solution directory, and put the pictureBox image into the folder and if folders Already created , it does not re-create And then copy the image directly into the old...
10 Jan 2011 by amiretto
Original title: "Dynamic search and display options in the search drop down list in the table that the search was conducted at the same time"HiI have a combobox in the table.I want to change the text inside the combobox inside the Grid ,columns in several tables to do my search and found...
21 Jan 2011 by amiretto
Thank youThe thing I needhttp://barnamenevis.org/asset.php?fid=64995&uid=32894&d=1295601825[^]http://barnamenevis.org/asset.php?fid=64996&uid=32894&d=1295601827[^]please help me
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"...
16 Aug 2012 by AmitGajjar
Hi,You can add your custom control in your page. That custom control should have features like,1) Paging for 10/20 records a page.2) page should be navigate through Next/Previous/First/Last/Goto.3) You need Searching in your custom Combobox.Here[^] some basic idea about Custom...
17 Dec 2013 by An@nd Rajan10
6 Feb 2015 by anand vemuri
for (int i = 0; i
26 Apr 2015 by anand vemuri
try herehttps://jqueryui.com/autocomplete/#combobox[^]
17 Jun 2011 by anandbprem
A dropdown with multiple checkbox list.After, I select some options and click on apply.then the selected list from the dropdown must list out in a listbox.Any suggestions, how to procede with this requirement.
4 Aug 2015 by Andrew Perkins
I've got a Combobox bound in the following fashion:The problem I'm having is when I initially populate the value of SelectedRodConnectionBoomSection, the Combobox does not show the value of BoomSectionInstance.Description. If I put a breakpoint in the property get, the value is...
18 Jan 2013 by Andrey Sitaev
Here I placed source files, binaries and brief instructions for FastGrid control.
1 Jan 2016 by ANIESH SUNDER
0down votefavorite1 I'M very basic in C# and Crystal reports.. I've Just started to do coding in Crystal Reports using c# windows application.. Actually my concept in crystal Report is to display only one record , from the data base.. For Eg:- Date, Received From, Sum of Amount...
23 Sep 2011 by AnilBaviskar
Hello All,I am facing difficulty in below situation:I have WPF datagrid with few columns. I want to show/hide certaincolumns based on combobox selection change.I tried using StaticResources, ObjectDataSource etc options but no use.What collection I should use & how the binding...
4 Oct 2013 by Animesh Datta
Hello , suppose you have one datagridview and their are two columns . one of them is combobox named as cmbproduct and other is textbox named as txtother. and if you want to bind the combobox value from dataset then cmbproduct.DataSource =...
17 Jan 2015 by antobaro
I have a multi columns combobox. After combo population, I try to set the default values, but I get an error messageThis is my codes public ObservableCollection Sedi { get; set; } private Model_Sedi _Sedi_Search; public Model_Sedi Sedi_Search { get { return...
18 May 2012 by arashmobileboy
First,i should say i searched a lot but i didnt find my solutioni did these works:1.this.dataGridView1[1, 1] = new DataGridViewComboBoxCell();Got This Error :Index was out of range. Must be non-negative and less than the size of the collection.Parameter name:...
21 May 2012 by arashmobileboy
How to Set Display Text Of ComboBox In Datagridview to for example :"Click Here To Open Drop Down List"Set Text In Combo Box Is Simple but Set Text To Datagridviewcombobox is not like comboboxAny One Who Found Useful Link please help me,because i didnt find any link related to my...
21 May 2012 by arashmobileboy
First I added my items to combobox(i fetched data from sql server database with datareader and added them to combo box) then i added this properties to my datagridviewcolumn(dgv_col) :dgv_col.DataPropertyName="name"dgv_col.DisplayMember="name"dgv_col.ValueMember="id"name is a field...
16 Nov 2010 by Arindam Tewary
Hi,If you have used same DataTable for two control still you can manage two to have act independently. Check the following code here where I have used same DataTable object "dTSource" for two control,one DataGridView and another Combobox control. I sorted one column of Grid while keeping the...
31 Oct 2013 by arunrk87
Out of no help in Google, I came here to ask this.I have a table named Agent with columns AgentId and AgentName in Sql Server DB. Using Visual Studio 2008(VB.NET), I am developing a windows based app. I have a ComboBox control in a windows form. I need this ComboBox control to be filled with...
20 Nov 2013 by arunrk87
Got it! check the link belowhttp://stackoverflow.com/a/14868976/194276
5 Aug 2012 by AshishChaudha
Find out your solution from previous solution..please refer to the following linkConnectivity of Dropdown lists with two tables of SQL[^]thanksAshish
16 Oct 2012 by AshishChaudha
For getting the CategoryID you have to specify the name of your Category Dropdownlist, like as followsddlCategory.SelectedValueYou will get the value of your category and save it in database.Thanks
9 Oct 2014 by ashok rathod
Hi tom,First thingm you need to assign your selected value to some properties but here its seems that it is binded to some b.BankCountryID although i think it wont make any problemSolution :-->Bind country combobox-->On Loaded event first of all you need to select the first...
25 Dec 2015 by Ashutosh Dutondkar
Private Sub coursenamecmb_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles coursenamecmb.SelectedIndexChanged Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True") Dim dr As...
25 Dec 2015 by Ashutosh Dutondkar
I have datagridview in my form in which i have combobox in datagirdview and i want to display the selected values of combobox in other cell of datagirdview.My combobox contain products details and its price, so i want to display and calculate the selected price of the products in other cell of...
25 Dec 2015 by Ashutosh Dutondkar
Private Sub btstfidcmb_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles btstfidcmb.SelectedIndexChanged Dim con As New SqlConnection("Data Source=ASHUTOSH-PC\SQLEXPRESS;Initial Catalog=Art Station Management System;Integrated Security=True") Dim com As...
3 Feb 2016 by Ashutosh Dutondkar
Imports System.Data.SqlClientImports System.DataImports System.DrawingImports System.Web.UI.WebControlsPublic Class Services Private colCase As DataGridViewComboBoxColumn Private cproductTOTAL As DataGridViewTextBoxColumn Protected Sub Services_Load(sender As...
6 Feb 2016 by Ashutosh Dutondkar
Imports System.Data.SqlClientImports System.DataPublic Class Batches Dim com As SqlCommand Dim dr As SqlDataReader Dim da As SqlDataAdapter Dim dv As DataView Dim str As String = "" Public Function CheckEmptyTextbox(ByVal groupbox As GroupBox) As Boolean ...
20 May 2015 by Asmaa Tyseer
How can I create ComboBox takes its data from a specific table inside a DatagridView that data is taken from a table is linked to Combobox table by a relationship of one to many?
15 Feb 2010 by AspDotNetDev
Post your code for your Person class/struct. If it is a class, it looks like you are adding the same person to the list repeatedly (rather than creating a new instance each time).
15 Feb 2010 by AspDotNetDev
The reason it doesn't work is likely that you are using variables rather than properties on your struct.
18 Jan 2011 by astika
I want to assign the Text of a data-bound ComboBox. I tried setting the Text, SelectedValue, and SelectedItem properties but none of them seem to work. I would appreciate suggestions and tips on how best to approach this problem.none of them seem to work means My Work of Assigning Value to...
22 Oct 2014 by ATjong
I have a Radgrid with a RadComboBox in a templateColumn. My other columns are AutoGenerated. By default the template column comes as the first column in the grid. If I leave it like that, it will work just fine. But whenever I change the index of it (and it actually moves), the RadComboBox in...
6 Feb 2014 by atul sharma 5126
hello,I am trying to display a databound combobox in a Datagridview based on the selection in a mother combobox which is out of the said grid. I am able to display the blank combobox column in grid but gets the above error when the data is to be displayed.Private Sub GridDesign() ...
6 Feb 2014 by atul sharma 5126
GOT IT.I have to provide the datasource again for the combobox.well i don't understand why because i have provided the same for datagrid. but anyway the data is now populated in combobox.BUT now a new issue:By default the combo box is showing blank and i have to click on the arrow...
6 Feb 2014 by atul sharma 5126
How to get the selected value of datagridcomboboxcolumn as the same does not have the said property?
6 Feb 2014 by atul sharma 5126
Found it:row.cells(datagridviewcomobboxcolumn name.Index).value
29 Dec 2013 by Aung Kyaw Minn
change your project framework to 4.0, it works in framework 4.0
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) { ...
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...