473,586 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combo box starts off blank

Is there a reason when you have items in the items collection of a combo box
when set to dropdownlist mode why it doesn't select the first item by
default? by default it shows up as a blank box, which is strange unless you
manually select one or programaticly set the index to zero. thanks
Nov 20 '05 #1
4 1529
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
Is there a reason when you have items in the items collection of a combo box
when set to dropdownlist mode why it doesn't select the first item by
default? by default it shows up as a blank box, which is strange unless you
manually select one or programaticly set the index to zero. thanks


A listbox doesn't get the first item selected automatically too, so why
should this be done automatically for a combobox?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
in foxpro and a lot of MFC apps I have developed always had the first item
selected by default, along with ASP apps I've created. It seems strange to
have nothign selected but after you select something that you can no longer
change it to have nothing selected after that.
"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote in message
news:c7******** ***@ID-208219.news.uni-berlin.de...
* "Brian Henry" <brianiup[nospam]@adelphia.net> scripsit:
Is there a reason when you have items in the items collection of a combo box when set to dropdownlist mode why it doesn't select the first item by
default? by default it shows up as a blank box, which is strange unless you manually select one or programaticly set the index to zero. thanks


A listbox doesn't get the first item selected automatically too, so why
should this be done automatically for a combobox?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
Hi Brian,

You can set it selected index to -1
This is when you want to use it as a combobox (combined dropdown and
textbox, this version is as far as I know not on ASP). You can set it using
dropdownstyle to dropdownlist the form you find in an ASP page.

I hope this helps?
Cor
in foxpro and a lot of MFC apps I have developed always had the first item
selected by default, along with ASP apps I've created. It seems strange to
have nothign selected but after you select something that you can no longer change it to have nothing selected after that.

Nov 20 '05 #4
* "Brian Henry" <br**********@n ewsgroups.nospa m> scripsit:
in foxpro and a lot of MFC apps I have developed always had the first item
selected by default, along with ASP apps I've created.
If this was the default behavior in .NET, I would consider it to be a
bug. Selection should be done by the user.
It seems strange to
have nothign selected but after you select something that you can no longer
change it to have nothing selected after that.


Set the control's 'SelectedIndex' property to -1, this will remove the
selection. For databound textboxes, you will have to do that twice
because of a bug.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9357
by: B | last post by:
I know there are several ways to speed up combo boxes and form loading. Most of the solutions leave rowsource of the combo box blank and set the rowsource to a saved query or an SQL with a where clause after users typed in one or several letters/digits. My problem is as follows Most of the time I need to display form in continuous format,...
5
3306
by: will eichert | last post by:
Greetings. I have a problem with a combo box incorrectly displaying blank items when returning to a form from a modal form. It's fine when the main form first comes up, but gets messed up when the main form is reactivated following opening and closing a modal form. Strangely, this was not a problem until I started using my Access 2000 db in...
6
11770
by: CindyH | last post by:
Hi Does anyone know how to create a multi column combo box from the same table? Thanks, Cindy
10
9550
by: lorirobn | last post by:
Hi, I have a form with several combo boxes, continuous form format, with record source a query off an Item Table. The fields are Category, Subcategory, and Color. I am displaying descriptions, not ID's, so I have to convert the ID's from various lookup tables. The combo boxes work fine except for subcategory, which is dependent on...
9
4449
by: Kay | last post by:
Hi all, Could you tell me the best way to add a blank item(as first item) in a data binded combo box? Because I think I didn't do it right and it generate an error if the second item(after the top blank item) is selected by using Combo.SelectedValue : "Specified argument was out of the range of valid values. Parameter name:...
9
6750
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the second combo to change depending on what values the user selects in the first box, it's just that every time the user changes the first combobox, the...
0
1952
by: mollyf | last post by:
I've got a combo box that I want to bind a collection to. I got the error "Complex Data Binding accepts as a data source either an IList or an IListSource" so I tried using the BindingSource, which works except when I want to have a blank line as the first item in the combo box--then all that is displayed is the type of object. Here is the...
8
8243
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the company and has been flagged inactive. If you have a filter on the rowsource like Where Active = True then Joe's name would not show up in the combo...
2
7037
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a...
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8202
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3865
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.