Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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.
 
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 2-Dec-12 19:10pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
0 DamithSL 265
1 CPallini 235
2 OriginalGriff 233
3 Maciej Los 175
4 George Jonsson 170
0 OriginalGriff 5,305
1 DamithSL 4,382
2 Maciej Los 3,760
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,901


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 3 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100