473,410 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

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 1523
* "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**********@newsgroups.nospam> 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
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...
5
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...
6
by: CindyH | last post by:
Hi Does anyone know how to create a multi column combo box from the same table? Thanks, Cindy
10
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,...
9
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...
9
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...
0
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,...
8
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...
2
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.