Activating/Deactivating Menus on the Other Form

G

Guest

Dear all,
I create a main form that has menu to open login form. The main form has
menus disabled at first load (except menu to open login form). When the login
form pops up, user can give his/her credential to connect to database and
activate appropriate menus based-on his/her level.

I have written this code under cmdConnect_Click:
01 Dim frmLogin as New Login
02 frmLogin.ActivateMenu(UserLevel)
03 frmLogin.Show
04 Me.Close
-->Results in a new main form pops up.
In I omit the New keyword at line 01, then an error will occured said that
"Object Reference not set to an instance."
Pls advice. Thank's
 
S

Stoitcho Goutsev \(100\)

Hi,

What is the problem and what is the question?

If you omit New you'll get this exception because you are trying to call
methods via reference that is not initialized. This is exactly what is
expected to be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top