Why use a module at all? I would switch it to a shared class instead but either way there is no reason to have the instance of form3 to be created at that scope. You can have the compile function create the instance and solve the problem.
VB Code:
Module Compile Public Function Compile(ByVal Code As RichTextBox [b]Dim Errorfrm As New Form3[/b] 'inside the method call ' SHOW THE ERROR FORM INCASE THERE IS AN ERROR Errorfrm.Show() ' THE SECOND TIME I RUN THIS FUNCTION THIS IS WHERE I GET THE ERROR. THE FIRST TIME EVERYTHING RUNS FINE ' CHECK TO SEE IF THERE ARE ANY LINES IN THE CODE ' IF NOT REPORT A MAJOR ERROR AND EXIT If (Code_Length = 0) Then ' ADD THE ERROR TO THE LIST Errorfrm.Errorlst.Items.Add("Line 0 - Error Code 1 - Major error, no code to be compiled") ' SINCE IT IS A MAJOR ERROR, NOTHING TO COMPILE ' EXIT THE FUNCTION AND RETURN CONTROL BACK TO THE CALLING FUNCTION Exit Function End If End Function End Module




Reply With Quote