Solved

Toolbar with Mdichilds

Posted on 2000-04-19
5
246 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

803 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