Solved

Toolbar with Mdichilds

Posted on 2000-04-19
5
242 Views
Last Modified: 2010-05-02
yeah let me first of all thank u for trying to answer my question.
u know i'm  using a toolbar for my project and a single toolbar is used for all the mdichilds.However i want my toolbar to be independent upon waht form is open.in other words if form A modifies the toolbar.Form B ,when activated should not see the toolbar affected.u see what i mean.
it is as if each form has its own toolbar.plz help me 'cause i have to return my project in 6 days.please help.Thanx in advance
0
Comment
Question by:yarroo
  • 3
5 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2733531
in each form's activate event, just code in which elements of the toolbar should be visible to that particular form.  If FormA changes a caption from one word to another then when FormB is activated just set it back to its original value (or to whatever special value it should have for FormB), and just repeat for each element of the toolbar that each from needs/requires.
0
 

Author Comment

by:yarroo
ID: 2733582
i would like to say something much clearer
if a user clicks on button new then it is apparent that delete is disabled 'cause u cannot delete document which has not yet been created.so delete is disabled.
suppose now i open another form for viewing.in this case delete should be enabled to allow me to delete an existing transaction.what if i come back to the previous loaded form.i should see delete still a disabled button.how can i do this.plz help
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2733594
in each form create a boolean variable.  say FormA is the form you just selected new from. At the top of FormA:

Option Explicit
Dim showDelete As Boolean

In FormA's load event set showDelete = False (since theres nothing there yet)
and the button for delete to disabled.

Private Sub Form_Load()
   showDelete = False
   btnDelete.Enabled = False
   etc...
End Sub


Now once you create a document that allows for it to be deletable, you set btnDelete.Enabled = True as well as showDelete = True.

Now in your FormA's activate event, you check your boolean variable.

Private Sub Form_Activate()
  If showDelete = True Then
     btnDelete.Enabled = True
  Else
     btnDelete.Enabled = False
  End If
End Sub

you will do this for each item that is in question.  create a boolean variable for it and check these boolean variables upon activating the forms.
0
 
LVL 1

Accepted Solution

by:
prakashbitra earned 75 total points
ID: 2735334
hi yarroo! this answer may help u to complete ur project in time.

create a tool bar with fixed tool box style and place this window in a specified position by using .top and .left properties.

use tag values of FormA, FormB forms as the key to the too bar window. on every form load assign the form tag value to a Public variable say varTag.

use this varTag variable in the tool bar window.
say for example if u have New , Edit and Delete buttons are existing in the tool bar window.

on clicking the New button in the tool bar on click event use the sample code as follows :
if varTag = "FormA" then
        do statments for FormA form
else do some statements

simple..

bye
happy working..
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2735395
prakash the question is how to keep the toolbars properties independent and specific to a particular form, not how to tell the program which form will be affected by clicking on a button.  Obviously the form with the focus should receive the input.  The main question proposed was how to keep track of a form's particular instance of the toolbar.  Also when you start off a comment like "this may help you", then just post a comment. Actually you should always just post comments especially when there have already been comments made to aid the questioner.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

707 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

15 Experts available now in Live!

Get 1:1 Help Now