Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

how to refresh dataset and binded controls (like textbox) after change in database table.

I have open a form "FormA". It has dataset table, and some controls like textbox are binded to this dataset, e.g.
txtState.DataBindings.Add("Text", myDataSet.Tables("patient"), "state")
While this form is open, I open another form "FormB" and in that I change the state value in the database table, close FormB and then come back to FormA.

Now I have to  refresh the dataset and textbox to show the current value of state, how is it possible.

Thanks a lot.
0
greatroni
Asked:
greatroni
1 Solution
 
iboutchkineCommented:
Just rebind textbox to the dataset after refreshin dataset

' Binds the textbox to the source
                txtState.DataBindings.Add("Text", myDataSet.Tables("patient"), "state")
0
 
DotNetLover_BaanCommented:
Use this:
DataGrid.DataSource = Nothing
DataGrid.DataSource = YourDataSource
0
 
greatroniAuthor Commented:
 myDataSet.Clear()
   dataAdapterPatient.Fill(myDataSet, "patient")

This code did work, Thanks.
0
 
DotNetLover_BaanCommented:
oops... I am sorry... I read the whole Dataset thing as DataGrid....  it has been a long day..
Good to hear that you find the solution...  good luck
0
 
DarthModCommented:
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0

Featured Post

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!

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