?
Solved

disable menu bar with out going gray?

Posted on 2000-04-15
7
Medium Priority
?
224 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
[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
  • 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 800 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

765 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