Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Printing crviewer control by pressing one key only

Posted on 2003-11-02
8
Medium Priority
?
487 Views
Last Modified: 2008-01-09
Hi, I have a form (frmReport) which has one control on it (crvReport).

What I would like is when you press the "/" (Asc(47)) button the form must close and when pressing the "*" (Asc(42))  button the form must print and close.

The trouble is there is no keyboard event for the crviewer control.

What can I try?

TIA
0
Comment
Question by:jinxster
[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
8 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 9668698
Nothing in CR that I am aware of since it cannot respond to a keypress event.

I wonder if you could put a timer on the form and have it check for a keypress through Windows API calls.  I don't know how to do it but it might be possible.

mlmcc

0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 9670532
?

If you set keypreview to true on the form, you should get the form's key_press event.
Am I missing something?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9671054
Eddy - The Crystal control only exposes the click events.

mlmcc
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Accepted Solution

by:
jinxster earned 0 total points
ID: 9672002
Hi, Eddy, the keypreview property means that if controls on the form have a key(press, up, down) but nothing is inside, the form's key(press, up, down) prevails.

I found a work around, (without using API)

Basically, it goes like this:

Add a textbox on the form and make sure it is behind the crviewer control.
Write the necessary code in the key_press, key_down, key_up events of the textbox.
In the viewchanged AND gotfocus event of the crviewer control add: textbox.SetFocus

The events should work. This also works nicely to make page up and page down scroll through pages home goto first page, end goto last, etc.

Thanks.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 10170900
PAQ.  no refund unless he responds
0
 

Author Comment

by:jinxster
ID: 10176313
I gave my own solution so I do not feel anyone really earned any points, sorry.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…
Suggested Courses

636 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