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.
greatroniAsked:
Who is Participating?
 
DarthModConnect With a Mentor Commented:
Submitted to PAQ with points refunded (500)

DarthMod
Community Support Moderator
0
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.