Child form enables menu toolbar on main form?

Jnox

Active member
Joined
Apr 19, 2006
Messages
25
Programming Experience
Beginner
Solved, Scroll for solution!





Originial Question:

Is this possible to do. Here is how my program is set up.

user logs in on the child form. If log in is correct, the child form enables two menu bars on the main form then closes.

How do I send a command from child form to main form to execute specific code/sub?

I know how to pass data between forms, thats not an issue, but from what I've tried it only works for passing data and not enabling menus!

HELP!

Thank you!
 
Last edited:
You can send the data string "please enable menus" to main form.
 
Yes I did. I can display for example a message box in the main form, but I am unable to execute "ToolBar1.Visible = True"
 
Here is my main form code:
VB.NET:
Friend Sub LoadMenus(ByVal MenuPermissive As Boolean)
Dim Blah As Boolean
 
Blah = MenuPermissive
If Blah = True Then
MessageBox.Show("Test! IT WORKS!", Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.ToolBar1.Visible = True
End If
 
End Sub
Here is my child form code:
VB.NET:
MenuPermissive = True
Dim AccessMenu As New Form1
AccessMenu.LoadMenus(MenuPermissive)
 
Last edited by a moderator:
That code works fine here (VS2003), don't know why yours don't.
 
I am using VS2005 Express.

Thats very strange!

I'm still very puzzled by this, and I have to get this done today.

Any ideas?
 
Perhaps change your forum profile that now says VS2003.. ?

Why do you use Toolbar control in .Net 2.0? Menustrip control would be more appropriate. Btw, the code works fine in VS2005 also.
 
JohnH,

I have just created seperate application from everything else. It still doesnt work.

Can you pase in your code.

Are you using VS2005 or VS2005 Express(what I'm using)
 
I just used the code you posted in Express (plus showed the new form1 instance of course). There is no difference to the full Studio as this regards.
 
How is that possible!!!!!!!!!

are you using two seperate forms.

Can you compile the project on your computer and send me the file?

jnoxforall@hotmail.com

I'll open it up on my machine to see if it works.

THANK YOU!
 
here it is
 

Attachments

  • vbnet20-toolstripvisible.zip
    16.5 KB · Views: 24
I see how you did it. You are reopening the main form after you change the setting.

The way I need it to work is by having the main and child forms open, then controling the toolbar on the main form from the child form without reopening it.

I'm sure if you try that, it wont work!
 
Oh yeah, I have also noticed that you have it set up to use form 2 as the startup form.

Form1 is the Main form
Form2 is the child form
 
So what form opens what form here? It is of outmost importance to explain your situation properly, there exist no mindreaders you know!

If your main form starts and open a child form and need some info from the child form you make that information available so that main can read it when child form is finished. It's as easy as writing a public property in child form.
 
Well, this is a little hard to explain, but I'll do my best

---------------
Main form holds the menu strip

Child form holds the log in information.
When you log in with a specific account, the child form sends information back to the main form.

That information will tell the main form to show or keep the menu hidden according to the log in.
---------------

Can this be done any other way other than what I'm trying to do?
 
Back
Top