Close() in Load()

HeavenCore

Well-known member
Joined
Apr 10, 2007
Messages
77
Location
Bolton, England
Programming Experience
1-3
OK, quick question, i have many forms that are all based on a custom permissions system, basically when a form loads i wish to check the permission, if false unload the form.

eg:

VB.NET:
    Private Sub frmClients_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If PermClientViewForm = False Then
            MessageBox.Show("Sorry, bla bla", ApplicationName & " - Permissions")
            Me.Close()
        End If
    End Sub

This however throws up the error:

"Value Close() cannot be called while doing CreateHandle()"

understandable really, so what would be the best way of doing this?

any help would be great :)

Regards

HC.
 
chekc before calling form.
 
Back
Top