Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datacombo and Cancel-Button

Status
Not open for further replies.

Schweiger

Programmer
Apr 26, 2002
122
CH
Hi

I've got a form with some datacombos (Microsoft DataList Controls 6.0 (SP3) (OLEDB) what is MSDATLST.OCX Version 6.0.84.18) and Textboxes etc. on it and last but not least a Button cancel with it's cancel.Property set to true.
The trouble is, that Esc doesn't work when one of the datacombos has the focus.
I can catch the Esc-Key in the Keyup-Event of the datacombo, that's true. But if there would be a trick just to get it to work like any other control I would be happy because I would like to have a generic approach.

Thanks for any help in advance
Andreas
 
Set the Form's KeyPreview to True, turn off the Cancel property for the Cancel button (properties window: Cancel = False,and then put this in the Form's KeyUp event:

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyEscape Then
cmdCancel.Value = True
Debug.Print "Now I'm a happy camper..."
End If
End Sub
 
Yes this works fine for some of my forms, but others have several frames on it and the visible frame determins which commandbutton acts as the cancel-button...
I can handle this too with your code, that's right but I have to change the whole implementation of my classes as they relay on a cancel-button being available. But I can do that too... it would only be so nice to come around this matter more elegant... ;-)

thank you all the same CCLINT
Andreas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top