Form open

AccessShell

Member
Joined
Jun 14, 2016
Messages
21
Programming Experience
10+
I can' seem to open a form

In Public Class frmX
Inherits System.Windows.Forms.Form
Dim oForm as frmX

In Private Sub frmX_Load(... Normal stuff ...)
oForm = New frmX
oForm.Show()


NOTE: On the green line above I can't get the () to stay at the end.

When run I get am error msg on the last line
Microsoft Development Environment
An unauthorized exception of type 'System.ComponentModel.Win32Exception'
occurred in system.windows.forms.dll"

Is this a windows handle issue, an shouldn't this happen automatically?

Thanks
 
Firstly, if you're going to post code then please post the code as it is. Don't prepend "In" because that simply makes it harder to read. Also, please use code formatting tags. Generally you should use

[xcode=vb]your code here[/xcode]

to get automatic syntax highlighting but, if you want to add extra formatting of your own, you should use

[code]your code here[/code]

As for the disappearing parentheses, forget about it. You don't need them unless the constructor has parameters and the fact that they disappear by default means that Microsoft recommend omitting them.

As for the exception, why on earth would the frmX class be creating and displaying a frmX object when it loads? That means that loading one frmX will load another, which will load another, which will load another and so on. Why would you want that?
 
Back
Top