Solved

disable menu bar with out going gray?

Posted on 2000-04-15
7
220 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

839 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