Solved

disable menu bar with out going gray?

Posted on 2000-04-15
7
217 Views
Last Modified: 2010-05-02
When my application prints and simultaneously the user clicks on File and Print from the menu bar and trys to print again befor the first one is done it causes an error. I can disable the File menu but this case's the word "File" to go gray which look's strange. If I disable the entire form it loose's focus. How can I keep the user from clicking on the File menu during printing. If I make the form a child in a MDI, it can be disabled with out loosing focus. Is that the only way? I am using VB 4 16 bit and VS Printer 1
0
Comment
Question by:davidb
  • 3
  • 2
  • 2
7 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 2719573
how bout create a boolean variable called Print

set it to True when printing begins

then in mnuPrint_Click function first test if Print = True and if it is exit the sub
0
 
LVL 14

Accepted Solution

by:
wsh2 earned 200 total points
ID: 2720289
Azra:
You don't need the boolean variable.. just directly set

mnuPrint.Enabled = False

then only the Print subitem on mnuFile will be grayed out.. <smile>.
--------------------------------------

Another approach to this problem would be to make a seperate form (frmPrint).. place a label stating "Printing" and a Progress bar. Before you print.. do a frmPrint.Show vbModal. While you are in your print loop, update the progress bar. When the print is finally done, just execute a UnLoad frmPrint to make the form disappear.

The frmPrint.Show vbModal locks the focus on frmPrint and the user will not be able to do anything in the program until frmPrint goes away.

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2720585
i was under the impression he didnt want anything grayed out.  again my assumptions lead me to...well they dont really take me anywhere. sorry for the confusion.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 14

Expert Comment

by:wsh2
ID: 2720961
Azra:
Please don't take my comment as being critical.. Your code is absolutely perfect to that assumption.. <smile>.

I interpreted the question differently.. and as such, directed my comment to you so as to add to your worthy comment rather than to detract from it. My solution.. is a different one than yours.. and I trust that the questioner is able to discern the difference between your solution (boolean flag and/or mnuItem.Disabled = False) and mine (vbModal Form).. <smile>.
0
 

Author Comment

by:davidb
ID: 2756077
Adjusted points from 100 to 200
0
 

Author Comment

by:davidb
ID: 2756078
I am trying to use your suggestion of frmPrint.Show vbModal, but the program stops at that line of code and doesn't continue to the printing code until the frmPrint is closed.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2756099
how about creating a boolean variable IsPrinting ...    =oP
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

706 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

21 Experts available now in Live!

Get 1:1 Help Now