|
-
Aug 1st, 2003, 12:51 PM
#1
Thread Starter
Hyperactive Member
Unloading a Module before calling it again.
In the Code examples below I call a module called Compile with a function called Compile. In that module you will see that I define a new form called Errorfrm as new Form3. If I click the meun button once and the errorfrm pops up and displays an error. I then close the newly displayed form and click the menu item again and I get an error in the module compile in the function compile when I try to display the errorfrm. So my question is, Do I have to unload the module or something so I do not get an error?
[code]
Private Sub MenuItem6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem6.Click
Compile.Compile(Code)
End Sub
[\code]
[code]
Module Compile
Dim Errorfrm As New Form3
Public Function Compile(ByVal Code As RichTextBox
' 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
[\code]
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
|