location combobox?

Hi all
I have a combobox that has locations in it. its a lookup combobox.
How can i add new locations to the combobox and save them back to the database?

Can this be done or do i need to make a little form to do it.  

Thanks you
Nerdy_Girl88Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DabasCommented:
Hi Nerdy_Girl88:
What do you mean by "location"?

Dabas
0
Nerdy_Girl88Author Commented:
Hamilton, Auckland, Wellington..........they are a list of citys.  
0
DabasCommented:
Nerdy_Girl88:
Sounds like NZ!
OK. Let me understand then.
You have a table in a database with a list of locations.
You read the table to fill your combobox.
Now the user wants to add a new location, say Rotorua
The user types it into the combobox, and now you want the original table updated with the new value
Is this what you were thinking of?

Dabas
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Nerdy_Girl88Author Commented:
Yep...Your on to it.
Can you help?

0
DabasCommented:
How are you filling your combobox?
DataAdaptor, dataset? Other?
A few snippets might help, as there are many ways to do this

Dabas
0
Nerdy_Girl88Author Commented:
I have a dataapter and a dataset.  

I have a form like this

textboxes
-FirstName
-LastName
-Address

Combobox
-Location

Datasets
-DsLocation
-DsClient

Not sure what else to include.  I have tru\ied searching on the net but I can't find what im looking for, usually this is because i have the terminilogy wrong,  What is this type of thing called?

thank you
 
0
Bob LearnedCommented:
Add the location to the table, and then refresh the list.

Bob
0
Nerdy_Girl88Author Commented:
What do you mean by refresh the list,  The combobox gets the values from a dataset.

??
0
DabasCommented:
Nerdy_Girl88:
I do not use that technique, but the following PAQ seems to be similar to your query:
http:Q_20935995.html "SIMPLE - Update Dataset from changed controls"


Dabas
0
Nerdy_Girl88Author Commented:
LearnedOne, Is this what you mean,

Get the new value entered by the user and add it to the datatable in the dataset, then update to the database?

NOt sure what you mean,  Im a beginner with this Vb.net Object Oriented programming.

Thank you

0
arif_eqbalCommented:
What LearnedOne means is update the newly entered location in the ComboBox into the database using the dataAdapter as you do and then ReBind the controls from the database so that they show the new value

There's an Alternate method as well, you must be updating your dataset when one full record is added the only problem might be that the new value entered in the combobox for location would not be available in the list for next Add operations

So you can use the following to update the combobox whenever a new item is added

On the Lost Focus of the ComboBox add

If Not ComboBox1.Items.Contains(ComboBox1.Text) Then ComboBox1.Items.Add(ComboBox1.Text)

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.