Solved

Changes made in one form are not shown on another form

Posted on 2009-04-02
3
151 Views
Last Modified: 2013-11-26
I have a form called employee that shows all employees in a datagridview.  When you double click on an employee, a new window opens and displays the data for that employee.  When the user changes data and saves it, the changed data is not being shown in the employee form.  IF I exit the employee form and come back in, the changed data shows.  How can I get the changes made on the one form to reflect back in the main form?
Employee.vb

Private Sub Employee_Load(...) Handles ...

Try

  My.Forms.Startup.EmployeesTableAdapter.Fill(My.Forms.Startup.PfmsDataSet.Employees)

Catch ex as Exception

  MsgBox(ex.Message)

End Try

End sub
 

Public Sub ReloadEmployees()

Try

  My.Forms.Startup.EmployeesTableAdapter.ClearBeforeFill = True

  My.Forms.Startup.EmployeesTableAdapter.Fill(My.Forms.Startup.pfmsDataSet.Employees)

  Em.EmployeeDataGridVIew.Refresh()

Catch ex As Exception

  MsgBox(ex.Message)

End Try

End Sub
 

ModifyEmployee.vb
 

Private Sub SubmitButton_Click(...) Handles ...

If SaveEmployeeData() Then

  ' Data is saved

  My.Forms.Employee.ReloadEmployees()

  Me.Close()

End If

End Sub

Open in new window

0
Comment
Question by:dyarosh
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Avelan earned 500 total points
ID: 24054674
I think you have to rebind the dataset to the gridview.

-Avelan
0
 

Author Comment

by:dyarosh
ID: 24059101
How do I do that programmatically?
0
 

Author Closing Comment

by:dyarosh
ID: 31566006
Turns out I was filling the wrong table.  Your suggestion for rebinding the dataset to the gridview showed me I was using the wrong table adapter.  Everything works fine now.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now