I have a "parent" form (if that's the right terminology), Form1. I
declare two public values in the parent form :
Public Class Form1
Inherits System.Windows. Forms.Form
Public CurDir As String = Directory.GetCu rrentDirectory( ) 'used
by FormGetJobOutpu t
Public PubUser As String 'tbxUser.text value for subForms
In the "child" form, I call it FormGetJobOutpu t, I reference these two
public values ...
Sub CreateGetJobOut putScript(ByVal filename As String)
Dim swScriptFile As New System.IO.Strea mWriter(CurDir( ) + "\"
+ filename, True)
swScriptFile.Wr iteLine("open xxx.xxxx.com")
swScriptFile.Wr iteLine(PubUser )
The reference to CurDir works fine. (Although there is something a
bit strange about it. I type "CurDir" but VS adds the parens. I have
no idea why. But VB.Net seems to be happy with that syntax and it
executes fine. But the reference to PubUser results in error message
"Name 'PubUser' is not declared. If I use Form1.PubUser I get error
"Reference to a non-shared member requires an object reference."
I also tried a different declare for PubUser (Public PubUser As String
= "") but that also did not help.
What do I have to do to use PubUser in the child form? Why can I
reference CurDir but not PubUser?
Thanks, Bob