Object reference Error keeps coming up
Posted on 2004-12-01
I'm writing some code that passes strings between two forms. At first i was passing them like this:
public user_name as string
public proj_codes() as string
dim frmMain as form1
frmMain.user_name = "test"
frmMain.proj_codes = array
My code would be okay for the "frmMain.user_name = "test"" line but would put up the error
An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object.
For the second line. So i tried to put it in a module and it works. but now i have a subroutine being called from form2 that is in the module to run a subroutine in form1. The same error keeps popping up, but this time at the beginning of Form1: Public Class Form1. Am i doing anything wrong. All i want to do is pass some strings from Form2 into Form1 after a button is clicked. thanks in advance for any help!