Solved change toolbar from another form

Posted on 2004-09-08
Last Modified: 2010-04-17
I have a login box called frmlog and I want to have the user log in and if corret loginname and password then show a toolbar button that is invisible.

Now I have a mdiform and the frmlog is a child

so I tried this

under my ok button:

if text = "name" and pass = "Pass" then
dim mdiform as mdiform
mdiform.toolbar1.buttons.item(2).visible = true

end if

I get an error

then I tried:

if text = "name" and pass = "Pass" then
dim mdiform as new mdiform
mdiform.toolbar1.buttons.item(2).visible = true

end if

no error but nothing happens

what am I doing wrong????
Question by:peanut1010
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 12010896
If frmlog is a child of an mdi form, then you should be able to manipulate the parent form using the Parent property.

Something like:

    if text = "name" and pass = "Pass" then
        Me.Parent.toolbar1.buttons.item(2).visible = true
    end if


Author Comment

ID: 12012713
doesn't work I get a blue line under


error states not a member of ',control

The code for frmlog calling is

I have a toolbar that says Log.

The user clicks on log it runs this

dim frmlog as new frmlog
frmlog.mdiparent = me

then under the ok button on the frmlog I tried your suggestions:
 if text = "name" and pass = "Pass" then
        Me.Parent.toolbar1.buttons.item(2).visible = true
    end if

but like I stated I get that error

Accepted Solution

tzxie2000 earned 25 total points
ID: 12015801
code under below may fit your require

in LogForm  the button click event is :

Dim f As Form1
f = Me.ParentForm
f.ToolBar1.Buttons.Item(1).Visible = True

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

ID: 12015948
nope, does nothing. I am a little lost though why would u use

dim f as form1. I don't even have a form1. I changed it to frmlog. but still got error.

Please try this:

Go to and create new project have two forms .

name the 1 form frmmdi and the other frmlog

now on the frmmdi add a toolbar and add a button with text= "Boy"
Now then go to the properties and select True for IsMdiContainer.

Now for frmlog go and add 1 textbox and a button.
Write this for the button
if textbox1 = "day" then
 'this is the part where I need to change the toolbarbutton from Boy to Girl
end if


Expert Comment

ID: 12015964
form1 mean the main form
I am just testing the code. so I set the main form as form1

Expert Comment

ID: 12016020
sorry for the name different between us
you should set form1 to mdiform
I just review the problem you published

Author Comment

ID: 12016195
worked great. I am lost though what does the f represent. really confussing I can't wait until vb 8. I have been playin with it and this stuff is easier.


Expert Comment

ID: 12016230
your welcome
exchange our knowledge make us skillfull

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is about my first experience with programming Arduino.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question