473,322 Members | 1,405 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.

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.text)" 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 2903
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*****@discussions.microsoft.com> wrote in message
news:85**********************************@microsof t.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.text)" 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.text)" 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.text)" 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*****@discussions.microsoft.com> wrote in message
news:85**********************************@microsof t.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.text)" 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.text)" 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.text)" 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.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- 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.Ravichandran"
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

"Ravichandran 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.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- 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.Ravichandran"
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
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
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...
6
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. ...
2
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...
3
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"...
9
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...
2
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...
6
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
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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: 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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.