|
-
Sep 21st, 2006, 11:47 AM
#1
Thread Starter
Junior Member
[RESOLVED] Passing info between instances of forms
What's the best way to pass info between instances of forms in VB.NET?
If I remember right, in 6.0 you could just declare a global variable, but they seem to have gotten rid of that in .NET.
This is in a program to read and write to a database. When I'm reading records in the program, I made the option to "EDIT" the record. Right now, that button brings up a new form on which to make the edits. I'm trying to figure out a way to give the record index and the primary key of the record to the EDIT form from the READ form so I can edit the right entry. How can I pass those two integers to the edit form when I initialize it (or soonthereafter).
Any help is appreciated, thanks!
Last edited by Sgt Spike; Sep 21st, 2006 at 01:15 PM.
-
Sep 21st, 2006, 12:18 PM
#2
Addicted Member
Re: Passing info between instances of forms
Add a module to your project and declare public variables.
VB Code:
Module Module1
Public _Test As String
End Module
Both forms in your project can set/read the value in _Test.
-
Sep 21st, 2006, 01:14 PM
#3
Thread Starter
Junior Member
Re: Passing info between instances of forms
Perfect! That exactly what I was looking for. I was on the right track, because I did try creating a class to hold variables, but I was using subroutines to get and set the variables, and it wanted me to instantiate the class to use them. Thanks a bunch!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|