Solved

Toolbar with Mdichilds

Posted on 2000-04-19
5
248 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
[X]
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
  • 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
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…
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…

734 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