Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Oct 1, 1996

Sharing Data Between Forms

Question:
I have a VB app that uses multiple forms. On the first form, I enter customer information. The other forms calculate the cost of my services to my customer. I would like to be able to share data between forms. That is, when I enter data in the first form like "estimate number" and "quantity", I would like these fields to be visible and showing the current record I just created when I open any of the other forms. Is this possible? If so, how? I have not been able to find a way. I am a novice at VB and would appreciate any help in this area. Please if possible, keep it simple because I don't know a great deal about VB yet, but I'm trying. Thanks in advance.

Answer:
The easiest way to do it is to declare a global variable in a .BAS file. Whenever the user types something in, put the value into that variable. Then, when the other form loads, take the value from the variable and put it in the control. That's all there is to it.

Under VB4, you can start forms with different methods other than just Show/Load, and data can be passed to the form that way.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date