473,765 Members | 2,059 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding Combo Box Items

vb
Hi,
I am new to .Net.

I am using a Combo Box in my windows forms. I am adding the items by
creating the instances and adding the same to the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that if we have 6
or 7 combo boxes in a form, isnt it a problem in creating that number of
instances everytime the form is opened/activated
2. How do I dispose the Combo Box items.

Your comments/response is greatly appreciated.

thanks
vb
Nov 21 '05 #1
6 2671
Svae the datasource in a module or a shared property as a class. Then, just
set the datasource of the combobox to this value - set the displaymember and
valuemember properties accordingly.

You're abosultely right though - reloading this each time is a pig - but if
you just load a dataset at init and then use a shared property, you're good
to go.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"vb" <vb@discussions .microsoft.com> wrote in message
news:CA******** *************** ***********@mic rosoft.com...
Hi,
I am new to .Net.

I am using a Combo Box in my windows forms. I am adding the items by
creating the instances and adding the same to the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that if we have 6
or 7 combo boxes in a form, isnt it a problem in creating that number of
instances everytime the form is opened/activated
2. How do I dispose the Combo Box items.

Your comments/response is greatly appreciated.

thanks
vb

Nov 21 '05 #2
Svae the datasource in a module or a shared property as a class. Then, just
set the datasource of the combobox to this value - set the displaymember and
valuemember properties accordingly.

You're abosultely right though - reloading this each time is a pig - but if
you just load a dataset at init and then use a shared property, you're good
to go.

--
W.G. Ryan MVP (Windows Embedded)

TiBA Solutions
www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
"vb" <vb@discussions .microsoft.com> wrote in message
news:CA******** *************** ***********@mic rosoft.com...
Hi,
I am new to .Net.

I am using a Combo Box in my windows forms. I am adding the items by
creating the instances and adding the same to the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that if we have 6
or 7 combo boxes in a form, isnt it a problem in creating that number of
instances everytime the form is opened/activated
2. How do I dispose the Combo Box items.

Your comments/response is greatly appreciated.

thanks
vb

Nov 21 '05 #3
VB,

When there is used a datagridcombobo xcolomn, than there are mostly a lot
more comboboxes as you now tell on a form.

I never heard a complain in this newsgroup.

Never think about disposing when you do not need to do it, it can be usefull
to clear bitmaps something faster because they are mostly huge
memoryspenders.

Relaeasing resources is one of the reasons dotNet is made.

Just my thought,
Cor

"vb" <vb@discussions .microsoft.com>
Hi,
I am new to .Net.

I am using a Combo Box in my windows forms. I am adding the items by
creating the instances and adding the same to the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that if we have 6
or 7 combo boxes in a form, isnt it a problem in creating that number of
instances everytime the form is opened/activated
2. How do I dispose the Combo Box items.

Your comments/response is greatly appreciated.

thanks
vb

Nov 21 '05 #4
VB,

When there is used a datagridcombobo xcolomn, than there are mostly a lot
more comboboxes as you now tell on a form.

I never heard a complain in this newsgroup.

Never think about disposing when you do not need to do it, it can be usefull
to clear bitmaps something faster because they are mostly huge
memoryspenders.

Relaeasing resources is one of the reasons dotNet is made.

Just my thought,
Cor

"vb" <vb@discussions .microsoft.com>
Hi,
I am new to .Net.

I am using a Combo Box in my windows forms. I am adding the items by
creating the instances and adding the same to the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that if we have 6
or 7 combo boxes in a form, isnt it a problem in creating that number of
instances everytime the form is opened/activated
2. How do I dispose the Combo Box items.

Your comments/response is greatly appreciated.

thanks
vb

Nov 21 '05 #5
"vb" <vb@discussions .microsoft.com> schrieb:
I am using a Combo Box in my windows forms. I am adding
the items by creating the instances and adding the same to
the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that
if we have 6 or 7 combo boxes in a form, isnt it a problem in
creating that number of instances everytime the form is
opened/activated
What problems do you think of? There may be performance problems if you are
adding hundreds of items when the form is shown, and maybe there will be
memory problems if you are adding a large number of elements.
2. How do I dispose the Combo Box items.


Simply remove them from the combobox and dispose them, if they implement
'IDisposable'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #6
"vb" <vb@discussions .microsoft.com> schrieb:
I am using a Combo Box in my windows forms. I am adding
the items by creating the instances and adding the same to
the list.
My questions/doubts are:
1. If I have 25 to 30 options in each combo box and like that
if we have 6 or 7 combo boxes in a form, isnt it a problem in
creating that number of instances everytime the form is
opened/activated
What problems do you think of? There may be performance problems if you are
adding hundreds of items when the form is shown, and maybe there will be
memory problems if you are adding a large number of elements.
2. How do I dispose the Combo Box items.


Simply remove them from the combobox and dispose them, if they implement
'IDisposable'.

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

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

Similar topics

6
3076
by: 6thirty | last post by:
Hi, I've created a stocktaking database using Access XP. This is indexed by two fields - part number and shelf location. I am currently inputting all the data via a form. When I have entered a record such as: part number 202354-001 location C1-01
4
24751
by: Gav | last post by:
I am using VS 2005 and am trying to add items to a combo box using C#. I know how to add simple text items but I am trying to add a value and some text ie. Value Text A First Text B Second Text I've seen examples of ListItem but I can't seem to get this to work, can anybody offer any advice.
0
299
by: vb | last post by:
Hi, I am new to .Net. I am using a Combo Box in my windows forms. I am adding the items by creating the instances and adding the same to the list. My questions/doubts are: 1. If I have 25 to 30 options in each combo box and like that if we have 6 or 7 combo boxes in a form, isnt it a problem in creating that number of instances everytime the form is opened/activated 2. How do I dispose the Combo Box items.
6
3131
by: Juan Pedro Gonzalez | last post by:
I wanted to add a Combobox to a toolbar... Kind of the look you get on VisualStudio's toolbar. I've been able to find some VB 6 samples, but the placeholder option is no longer available for ToolbarButtons... Does anyone know how this could be done? Looking forward to hear from you,
1
4478
by: stinehelferw | last post by:
I need a right-click menu on a form list control with combobox controls. I used View->Toolbars->Customize to create a toolbar. I added ComboBox through commands tab. I set properties to Popup making it a shortcut menu. I have no problem linking it to the list control. The menu comes up when I right-click the list control.
0
1964
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 code for filling the collection: Public Function GetCollection(ByRef cndb As SqlConnection,...
1
2467
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this guy's Javascript "combo box" - http://sandy.mcarthur.org/javascript/select/select.html. It allows my users (when I get some!) to select from a list of preexisting options and also to add a new one by clicking on "add new". Essentially it's a select...
1
1670
by: imwhiteandnerdy | last post by:
i'm hoping I can get some help with adding my combo box selection to my access database.Any Help would be appreciated. I've been told I need complex binding Basically I just want to add the selection to the database field DATABASE =cc TABLE =customer FIELD IN DATABASE= custCity COMBO BOX =cboCity My combo box name is cboCity Has the following collection of items linked
3
1839
by: =?Utf-8?B?Y2RtdW5veg==?= | last post by:
I have created a sub routine to programmatically add an indefinite number of combo boxes to a form. The combo boxes are bound in code to a view for displaying the available options. This routine works good until you add the second combo box. At that point it changes the first combo box's selected item. A third changes the second and first and so on. I've tried setting the combo box name and tag to a unique name, but that doesn't help. ...
0
9568
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8832
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3924
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
3
2806
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.