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

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 2641
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**********************************@microsof t.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**********************************@microsof t.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 datagridcomboboxcolomn, 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 datagridcomboboxcolomn, 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
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...
4
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 ...
0
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...
6
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...
1
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...
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,...
1
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...
1
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...
3
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.