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!

AcceptButton & CancelButton

Status
Not open for further replies.

GlynA

Programmer
May 1, 2002
77
GB
I have an ActiveX control written in VB6 which I have placed on a form in a VB.NET project.
The control contains a number of buttons, one of which is the default and one of which is the cancel button.
Is there any way I can assign these buttons to the AcceptButton and CancelButton properties of the form to get them to work correctly? The problem is that since they are not Windows forms buttons they do not implement the IButton interface.
Does anyone have a solution or a work-around? I would prefer not to migrate the control to .NET at this stage.

Glyn.
 
You can get the events of your control to show in C#, right? I would place your control on the form, double click a button--which would bring up the code window for that button's click event. The event should be established.

Then go back out to your design view. Open the events tab of the form's button. Go the click part, and select your method that references your AX control.
 
Thanks for your response RiverGuy, but it does not help. The buttons are on the ActiveX control and are correctly processed when they are pressed. What I am trying to do is get the appropriate buttons to respond when the Enter or Escape keys are used. This is usually done by setting the AcceptButton & CancelButton properties of the form, but I cannot set these properties to point to the buttons on the ActiveX control because they are VB6 buttons, not Windows Forms buttons.
Any ideas anyone?
 
Glyn,

A form key press event should help you do this.

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top