Solved

disable menu bar with out going gray?

Posted on 2000-04-15
7
219 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON Response and request in VB6 application 11 432
fso.FolderExists("\\server\HiddenFolder$") 4 68
vbModal 12 53
Excel Automation VBA 19 73
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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