Share Live Variable Changes Between Form Windows

I'm wondering how to make sure my forms have "live" links to variables in my other forms. I have a datagridview on one form where I make some selections, then I hit a button, and another form pops up displaying that information. If I select the right things on the first form and open the second, all is well. If I forget to select something, or try to change something selected in my datagridview after the second form is opened, the second form does not have the current information. I'm pretty sure I've just got a situation where the second form only "sees" the information from the first form that was present at the time the second form was opened.

How do I best remedy this so that the most up to date information is available to the second form?
diablo089Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GMGeniusConnect With a Mentor Commented:
Is the reference to the first form in the second forms load event?
if it is, you could try making a subroutine for the second form update and call it in the form load event and the form activate event,
That way if you click back to form 1 then click back to form 2 , this will fire the form 2 activate event again and call the refresh data.
0
 
GMGeniusCommented:
How is the second form accessing the information in the datagrid? on the first form
0
 
diablo089Author Commented:
In the form of:

(Name of Form).DataGridView1.Rows(index).Cells("Cell Name").Value
0
 
John (Yiannis) ToutountzoglouConnect With a Mentor Instructor Multiengine PilotCommented:
before you open the second form set a value to a "Public Variable"....You can use many Public variables....
so before you open the form let's say that SelValue is already an integer Public Var ..:
SelValue=Me.DataGridView1.Rows(index).Cells("Cell Name").Value (or FormatteValue)
Then in form 2 you can use SelValue anywhere...
0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
Other option Reffering also to my first comment is to open the second form as dialog..so the user does not have the chance to change something in the first form ..
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.