473,503 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combobox.items question

Hi,

I want to write code that will fill my combobox ONLY IF it
is currently empty. i need this code to run for the
combobox1.selectedindexchanged event. i wanted to know how
i can code this.
I have tried the following

if combobox1.items.count = 0 then
'run the code to add items to the combobox1
.....
.....
end if

i already have code to fill the combobox from my database
(this works fine), i am just not sure on to find out if
the combobox is currently empty so i know whether to run
this code or not.

thx in advance

Jul 21 '05 #1
1 1156
Hi Tonya,
I want to write code that will fill my combobox ONLY IF it
is currently empty. i need this code to run for the
combobox1.selectedindexchanged event. i wanted to know how
i can code this.
I have tried the following

if combobox1.items.count = 0 then
'run the code to add items to the combobox1
.....
.....
end if

i already have code to fill the combobox from my database
(this works fine), i am just not sure on to find out if
the combobox is currently empty so i know whether to run
this code or not.


Your code should work ... or did you have any problems with it?

Regards,

--
Frank Eller [.NET MVP]
www.frankeller.de
..NET Developers Group Munich- www.munichdot.net

Jul 21 '05 #2

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

Similar topics

4
1737
by: David Sworder | last post by:
Hi, I have a ComboBox that contains 1,400 sorted items . Here's the list: abba apple ... cabba caccaa capple
3
916
by: Nikolay Petrov | last post by:
I have a Combo box, binded to a dataset With cmbCompany .DataSource = dsSpecContact .DisplayMember = "Companies.CompanyName" .ValueMember = "Companies.CompanyID" End With What I want is to...
5
25828
by: James P. | last post by:
Hello, For my new Windows application, all I want is to create an initial form to demo to the user to show them how it looks like with some data on it. So I figure the fastest way is to create...
6
7792
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows...
5
3066
by: Chaos2651 | last post by:
I have Visual Studio .NET with all of the components installed onto it. I want to add items to a combo box at run-time through numerous subroutines. I previously did it with the combo boxes AddItem...
9
7297
by: Don | last post by:
Is there any way to detect when an item has been added to the Items collection of a combobox or listbox? I am inheriting a Combobox and want to validate items before they are added to the...
2
1607
by: murdock | last post by:
I am having an issue with graphical corruption upon re-selecting a combobox which upon 'selected index change' event should list file names in that folder in a separate combobox. Here is the code:...
9
2443
by: Franky | last post by:
I have a usercontrol that inherits from ComboBox I'd like to add the feature that the user can delete any item Best would be that he could right click an element and a messagebox would ask if...
1
2124
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to create a customized ComboBox where the methods ComboBox.Items.Add and ComboBox.Items.Insert will behave thusly: -- If the item is not present, add it. -- If the item is present, set the...
11
3267
Frinavale
by: Frinavale | last post by:
This question is going to sound a little crazy but.........How do you set the selected item in a ComboBox? I am populating a ComboBox with a bunch of instances of a custom private class: For...
0
7192
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,...
0
7064
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
7261
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
7445
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
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.