Solved

vb.net change toolbar from another form

Posted on 2004-09-08
8
259 Views
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????
0
Comment
Question by:peanut1010
  • 4
  • 3
8 Comments
 
LVL 85

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

Idle_Mind
0
 

Author Comment

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

  Me.Parent.toolbar1


error states not a member of 'System.windows.form,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
frmlog.show


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
0
 
LVL 5

Accepted Solution

by:
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

0
 

Author Comment

by:peanut1010
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 vb.net 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




0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 5

Expert Comment

by:tzxie2000
ID: 12015964
form1 mean the main form
I am just testing the code. so I set the main form as form1
0
 
LVL 5

Expert Comment

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

Author Comment

by:peanut1010
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.


0
 
LVL 5

Expert Comment

by:tzxie2000
ID: 12016230
your welcome
exchange our knowledge make us skillfull
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
drawing animated level bar based on numbers 3 86
tidtcpserver connection lost handle 2 69
Base1 Encode/Decode 3 67
"Black Box" Testing of Control System Software 2 17
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

930 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now