Sharing info between Forms
Sharing info between Forms
Sharing info between Forms
Sharing info between Forms
Sharing info between Forms
Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms
Sharing info between Forms Sharing info between Forms
Sharing info between Forms
Go Back  Xtreme Visual Basic Talk > > > Sharing info between Forms


Reply
 
Thread Tools Display Modes
  #1  
Old 03-26-2016, 01:33 PM
leezinho leezinho is offline
Freshman
 
Join Date: Jun 2009
Posts: 48
Default Sharing info between Forms


This should be a simple question: How can I share information between Forms? I declare a variable (like "Private xyz As Integer" in the code for Form1, but if I use it in the code for Form2 I get an error message. This, even if I call it "Form1.xyz".
Reply With Quote
  #2  
Old 03-26-2016, 04:57 PM
Flyguy's Avatar
FlyguySharing info between Forms Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 19,164
Default

If the variable is Private then you can not directly access it.
Either make the variable Public, or create Get/Let properties for it.
You can also put the variable in a Module and make it public, then it doesn't depend on the Form.
Reply With Quote
  #3  
Old 03-26-2016, 06:22 PM
leezinho leezinho is offline
Freshman
 
Join Date: Jun 2009
Posts: 48
Default

I had tried "Public", but received a message that that attribute was not available for an array (my variable is an array).
However, your suggestion of a Module worked. Thanks!
(I am self-taught, and I learn of resources only as they become needed.)
Reply With Quote
Reply

Tags
call, code, form1, form1.xyz, forms, info, sharing


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Sharing info between Forms
Sharing info between Forms
Sharing info between Forms Sharing info between Forms
Sharing info between Forms
Sharing info between Forms
Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms Sharing info between Forms
Sharing info between Forms
Sharing info between Forms
 
Sharing info between Forms
Sharing info between Forms
 
-->