Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Team,

Was interested on the following. Seams to many different answers after Google this.
(It could be I dont understand the concept of Databinding either, fairly new to this concept)

I have a list of Strings which came from a Database that I am databinding to a list Box.

VB
mXXBindiongs = new DataBindingSource
mXXDataSet = DB.GetDataSet

mXXBindiongs.DataSource = mXXDataSet
mXXBindiongs.DataMember = mXXDataSet.Tables(0).TableName

ListBox.DataSource = mXXBindiongs
ListBox.DisplayMember = "HeadingX"


With certain operations with-in the Winform I want to capture the resulting string add it to the list so it updates the Database as well as update the List Box in WinForm.

I am a little confused as the correct way to update this and all updates to occur.

If someone could help that would be wonderfull.
Many Thanks in advance.

Stephan
Posted

1 solution

You'll have to update the database with the new item, then requery the database to retrieve the updated table.

BTW, your binding is a bit screwy. You normally don't bind to a DataSet. You bind to a DataTable in the DataSet and the DataMember name is the column in the table you want to bind to.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900