Solved

Share Live Variable Changes Between Form Windows

Posted on 2010-09-02
5
260 Views
Last Modified: 2012-05-10
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?
0
Comment
Question by:diablo089
  • 2
  • 2
5 Comments
 
LVL 12

Expert Comment

by:GMGenius
ID: 33591019
How is the second form accessing the information in the datagrid? on the first form
0
 

Author Comment

by:diablo089
ID: 33591037
In the form of:

(Name of Form).DataGridView1.Rows(index).Cells("Cell Name").Value
0
 
LVL 12

Accepted Solution

by:
GMGenius earned 125 total points
ID: 33591079
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
 
LVL 18

Assisted Solution

by:John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou earned 125 total points
ID: 33591463
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
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
ID: 33591590
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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

758 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

23 Experts available now in Live!

Get 1:1 Help Now