?
Solved

Changes made in one form are not shown on another form

Posted on 2009-04-02
3
Medium Priority
?
159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Avelan earned 1500 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

765 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