Using Global/Public Variables

JOSHSKORN
12-06-2004, 04:45 PM
I have two forms. The program is this:

Form1: You type in the name of the file, click the COPY button and it copies the file from one specific location to another specific location. That works fine. I have a button on it called View List, which takes you to to Form2.

Form2: This form is a list of files available to copy (in a list box), which reads off of an Access Database. I have it set to be able to retrieve a specific file name that I select, shown in a message box. I want to be able to put this filename on a textbox in Form1.

In Short, when I go to Form2, I want to be able to select a filename and have it appear in Form1 after I close Form2. Note that Form1 never unloads or hides, it's the initial startup form. Form2 shows/hides when necessary.

In VB 6.0, this was very easy...but not in VB.NET.

Iceplug
12-06-2004, 07:19 PM
You have to pass a reference-to-first-form to the second form.
Dim F1 As Form1
VB.NET forces you to treat forms like the classes they are. VB6 gives you a handicap by having form references floating around all of the time.
Also, check out this thread on how you might assign references.
http://www.xtremevbtalk.com/showthread.php?t=147563

JOSHSKORN
12-07-2004, 01:50 AM
You have to pass a reference-to-first-form to the second form.
Dim F1 As Form1
VB.NET forces you to treat forms like the classes they are. VB6 gives you a handicap by having form references floating around all of the time.
Also, check out this thread on how you might assign references.
http://www.xtremevbtalk.com/showthread.php?t=147563

Thanks. I figured it out finally. I didn't understand what I did but I'm sure I will in due time. I have another question which I'll post in a minute.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum