PC Review


Reply
Thread Tools Rate Thread

Adding Combo Box Items

 
 
=?Utf-8?B?dmI=?=
Guest
Posts: n/a
 
      13th Nov 2004
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
 
Reply With Quote
 
 
 
 
W.G. Ryan eMVP
Guest
Posts: n/a
 
      13th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:CA08E539-2EAF-4B75-902B-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      13th Nov 2004
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" <(E-Mail Removed)>

> 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



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      13th Nov 2004
"vb" <(E-Mail Removed)> 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/>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding items to a combo box Phrank Microsoft Excel Programming 2 3rd Dec 2006 08:16 PM
Adding New items to a combo box on the Fly. =?Utf-8?B?TGVsZQ==?= Microsoft Access 4 9th Sep 2006 03:00 PM
Adding Items To a combo Box LoveCandle Microsoft Excel Programming 4 7th Apr 2006 09:58 PM
Adding items to a combo box =?Utf-8?B?VFM=?= Microsoft VB .NET 6 8th Dec 2005 08:05 AM
Adding items in Combo box Bala Nagarajan Microsoft Dot NET Framework Forms 5 7th Nov 2005 08:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:32 AM.