• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

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
0
Nerdy_Girl88
Asked:
Nerdy_Girl88
2 Solutions
 
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now