Click here to Skip to main content
Rate this: bad
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.
Posted 2-Dec-12 18:10pm

1 solution

Rate this: bad
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.

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

  Print Answers RSS
0 OriginalGriff 382
1 Damith Weerasinghe 370
2 thatraja 350
3 Sergey Alexandrovich Kryukov 259
4 Ajith K Gatty 200
0 Sergey Alexandrovich Kryukov 10,639
1 OriginalGriff 6,658
2 Peter Leow 4,735
3 Abhinav S 3,813
4 Maciej Los 3,565

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