By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,252 Members | 1,683 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,252 IT Pros & Developers. It's quick & easy.

Adding Combo Box Items

P: n/a
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
Share this Question
Share on Google+
6 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a
"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 discussion thread is closed

Replies have been disabled for this discussion.