473,395 Members | 1,641 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,395 software developers and data experts.

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 1151
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
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
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
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
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,...

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.