473,804 Members | 3,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combo box

Hi
Am new to programming and to this process of asking questions. I believe I
have read all the threads concerning combo box questions but haven't found an
answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the combo
box (hi-lited) but when i close the form the new item doesn't stay in the
collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain the new
item in the collection.

In additioin to to reading every help item concerning combo boxes in vb.net,
I have looked at every book I could find in the book store to see if there
was additional code I need to use to save the item in the collection but
can't seem to find anything.
I have tried doing this under the "selected index event" as well as the "key
press" event. I even tried using a button click event.

At first I had the combo box in a group box and then moved it out onto the
form.
I even set up a new solution and only had a combo box on the form but had
the same problem.

I have a suspension that some setting on a form property or another control
or on my set up of vb net is is causing this but I have run out of ideas
where to look.

If this turns out to be something ridiculously simple I apologize, but I do
need help.
Any ideas.
Thans.
--
Joe C
Nov 16 '05 #1
8 2927
Hi,
The items you add during design time is compiled into the assembly when you
build the program. Those items you add during runtime is not saved into the
assembly and will therefor not remain when you restart your program.

To achieve what you want you need to store the data externally, perhaps in a
textfile or the registry. Then you read this data and populate the combobox
during form_load.

/Mats-Lennart

"CZERNAI" <CZ*****@discus sions.microsoft .com> wrote in message
news:85******** *************** ***********@mic rosoft.com...
Hi
Am new to programming and to this process of asking questions. I believe I
have read all the threads concerning combo box questions but haven't found an answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the combo box (hi-lited) but when i close the form the new item doesn't stay in the
collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain the new item in the collection.

In additioin to to reading every help item concerning combo boxes in vb.net, I have looked at every book I could find in the book store to see if there
was additional code I need to use to save the item in the collection but
can't seem to find anything.
I have tried doing this under the "selected index event" as well as the "key press" event. I even tried using a button click event.

At first I had the combo box in a group box and then moved it out onto the
form.
I even set up a new solution and only had a combo box on the form but had
the same problem.

I have a suspension that some setting on a form property or another control or on my set up of vb net is is causing this but I have run out of ideas
where to look.

If this turns out to be something ridiculously simple I apologize, but I do need help.
Any ideas.
Thans.
--
Joe C

Nov 16 '05 #2
CZERNAI wrote:
Hi
Am new to programming and to this process of asking questions. I
believe I have read all the threads concerning combo box questions
but haven't found an answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the
combo box (hi-lited) but when i close the form the new item doesn't
stay in the collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain
the new item in the collection.

In additioin to to reading every help item concerning combo boxes in
vb.net, I have looked at every book I could find in the book store to
see if there was additional code I need to use to save the item in
the collection but can't seem to find anything.
I have tried doing this under the "selected index event" as well as
the "key press" event. I even tried using a button click event.

At first I had the combo box in a group box and then moved it out
onto the form.
I even set up a new solution and only had a combo box on the form but
had the same problem.

I have a suspension that some setting on a form property or another
control or on my set up of vb net is is causing this but I have run
out of ideas where to look.

If this turns out to be something ridiculously simple I apologize,
but I do need help.
Any ideas.
Thans.


Exactly what do you mean with "close the form"?
When and how do you see that the added value is not there?

A form is just a class (with a visual representation) . When you create
a new instance of a class, it will not have any values of some other instance
of that class.

--------------------------------------------
MyForm theForm = new MyForm();
theForm.Show();
theForm.Hide();
theForm.Show(); <-- shows the *same* form again with the *same* values
-------------------------------------------
MyForm theForm = new MyForm();
theForm.Show();
theForm.Hide();
theForm = new MyForm(); <-- creates a *new* instance
theForm.Show(); <-- as it is a different instance, it might show different values.
-------------------------------------------

Hans Kesting
Nov 16 '05 #3
On 17/12/2004 CZERNAI wrote:
Hi
Am new to programming and to this process of asking questions. I
believe I have read all the threads concerning combo box questions
but haven't found an answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the
combo box (hi-lited) but when i close the form the new item doesn't
stay in the collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain
the new item in the collection.


The ComboBox won't store these items when you close the app.

If you want to store them you will have to trap the form's closing
event, write the items out to a file of some sort and then re-load them
when you run the app again.

--
Jeff Gaines Damerham Hampshire UK
Posted with XanaNews 1.16.5.2 http://www.wilsonc.demon.co.uk/delphi.htm
Nov 16 '05 #4
Thank you all for your help.
It is very much appreciated.

Joe C

"Mats-Lennart Hansson" wrote:
Hi,
The items you add during design time is compiled into the assembly when you
build the program. Those items you add during runtime is not saved into the
assembly and will therefor not remain when you restart your program.

To achieve what you want you need to store the data externally, perhaps in a
textfile or the registry. Then you read this data and populate the combobox
during form_load.

/Mats-Lennart

"CZERNAI" <CZ*****@discus sions.microsoft .com> wrote in message
news:85******** *************** ***********@mic rosoft.com...
Hi
Am new to programming and to this process of asking questions. I believe I
have read all the threads concerning combo box questions but haven't found

an
answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the

combo
box (hi-lited) but when i close the form the new item doesn't stay in the
collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain the

new
item in the collection.

In additioin to to reading every help item concerning combo boxes in

vb.net,
I have looked at every book I could find in the book store to see if there
was additional code I need to use to save the item in the collection but
can't seem to find anything.
I have tried doing this under the "selected index event" as well as the

"key
press" event. I even tried using a button click event.

At first I had the combo box in a group box and then moved it out onto the
form.
I even set up a new solution and only had a combo box on the form but had
the same problem.

I have a suspension that some setting on a form property or another

control
or on my set up of vb net is is causing this but I have run out of ideas
where to look.

If this turns out to be something ridiculously simple I apologize, but I

do
need help.
Any ideas.
Thans.
--
Joe C


Nov 16 '05 #5
Thanks for your help.
Very much appreciated

"Jeff Gaines" wrote:
On 17/12/2004 CZERNAI wrote:
Hi
Am new to programming and to this process of asking questions. I
believe I have read all the threads concerning combo box questions
but haven't found an answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the
combo box (hi-lited) but when i close the form the new item doesn't
stay in the collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain
the new item in the collection.


The ComboBox won't store these items when you close the app.

If you want to store them you will have to trap the form's closing
event, write the items out to a file of some sort and then re-load them
when you run the app again.

--
Jeff Gaines Damerham Hampshire UK
Posted with XanaNews 1.16.5.2 http://www.wilsonc.demon.co.uk/delphi.htm

Nov 16 '05 #6
Thanks for your help
It is much appreciated.
JOe C
"Hans Kesting" wrote:
CZERNAI wrote:
Hi
Am new to programming and to this process of asking questions. I
believe I have read all the threads concerning combo box questions
but haven't found an answer to my problem.

I am using "combobox.items .add(combobox.t ext)" to add an item to the
collection
of the combo box. When the program runs I can see the new item in the
combo box (hi-lited) but when i close the form the new item doesn't
stay in the collection.
I put some items in the CB initially through the collection property.

I have used both the drop down and simple styles but neither retain
the new item in the collection.

In additioin to to reading every help item concerning combo boxes in
vb.net, I have looked at every book I could find in the book store to
see if there was additional code I need to use to save the item in
the collection but can't seem to find anything.
I have tried doing this under the "selected index event" as well as
the "key press" event. I even tried using a button click event.

At first I had the combo box in a group box and then moved it out
onto the form.
I even set up a new solution and only had a combo box on the form but
had the same problem.

I have a suspension that some setting on a form property or another
control or on my set up of vb net is is causing this but I have run
out of ideas where to look.

If this turns out to be something ridiculously simple I apologize,
but I do need help.
Any ideas.
Thans.


Exactly what do you mean with "close the form"?
When and how do you see that the added value is not there?

A form is just a class (with a visual representation) . When you create
a new instance of a class, it will not have any values of some other instance
of that class.

--------------------------------------------
MyForm theForm = new MyForm();
theForm.Show();
theForm.Hide();
theForm.Show(); <-- shows the *same* form again with the *same* values
-------------------------------------------
MyForm theForm = new MyForm();
theForm.Show();
theForm.Hide();
theForm = new MyForm(); <-- creates a *new* instance
theForm.Show(); <-- as it is a different instance, it might show different values.
-------------------------------------------

Hans Kesting

Nov 16 '05 #7
I am sure you are populating the combo in the load event and before
closing the form, you are not updating the data source of the combo with
the updated items.

Please post your code for more clarity.

with regards,
J.V.Ravichandra n
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandra n+J.V.&cob=aspn etpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID= P3966388&BN=999 &PN=2
- Or, just search on "J.V.Ravichandr an"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #8
Thank's for your reply. Itis much appreciated.
My problem is solved.
Joe c

"Ravichandr an J.V." wrote:
I am sure you are populating the combo in the load event and before
closing the form, you are not updating the data source of the combo with
the updated items.

Please post your code for more clarity.

with regards,
J.V.Ravichandra n
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandra n+J.V.&cob=aspn etpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID= P3966388&BN=999 &PN=2
- Or, just search on "J.V.Ravichandr an"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #9

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

Similar topics

3
4323
by: vgrssrtrs | last post by:
<html> <head> <script language="JavaScript"> <!-- /* *** Multiple dynamic combo boxes *** by Mirko Elviro, 9 Mar 2005 *** ***Please do not remove this comment
4
4283
by: Heather | last post by:
Hi I am desparately looking for advice in relation to storing the results after selecting items from two combo boxes on a Referral form. The first combo box 'ctl Type' displays a full list of Agency Types, then the 2nd combo box displays a list of Organisations, depending upon the Agency Type Selected. The first combo box 'ctlType' (Unbound), Row Source: to field in 'AgencyReferralType'.
6
3558
by: Support4John | last post by:
a2k (9.0.6926) SP-3 Jet 4.0 SP-7 I have a form with combo box field that allows the user to select from the combo box or type in the field value that may or maynot be in the combo box field. In the After Update Event of the combo box field how can I tell if the field value was selected from open combo box or typed in by the user? Thanks, John
2
2185
by: Jeff Mason | last post by:
I'm observing some strange behavior when I use a bound combo box in conjunction with the combo's anchor property. I define a form which contains just a textbox and a combo box. The text box is placed before the combo in taborder, and is there only so the focus will go someplace other than the combo box when the form is displayed. In the form load event, I have the following code to create an arraylist and bind the combo to it: Dim a As...
3
3658
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1" through "Phase 10" (there are 10 Phases I want to sort from) Once the phase has been selected a second combo box would populate.
9
6771
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the second combo to change depending on what values the user selects in the first box, it's just that every time the user changes the first combobox, the second combobox FOR EVERY RECORD goes blank.
2
2454
by: kiranmn75 | last post by:
I want to dynamically populate a combo box through javascript. Data is coming from a array. Sometimes data list may contain items in excess of 2000. Explorer takes more than 5 seconds to populate the combo (for a list of 2500). Can anybody optimize the code. I tried Duffs devise instead of 'for loop', but no improvement.
6
3685
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
7053
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a table called 'names'. The two columns in the combo box are ID and Surname. The combo box and list box...
0
9708
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
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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...
0
10085
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
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
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.