473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ActiveX ruins Validation events.

I am using an ActiveX control in a .NET application which I put on a
form. I have another .NET control on that form that handles the
Validating event. The method that handles the Validating event, shows a
message box and sets e.Cancel = True. When I click any other control in
the form, the message box shows and the focus returns to the control
that handled the Validating event. The problem happens when I click on
the ActiveX control. The ActiveX control gets the focus and the focus
doesn't return to the validated control and no message box is
displayed. With a different ActiveX control the message was displayed,
but the focus didn't return to the validated control.

I reproduced the bug in a small application. In that application I
wrote an ActiveX in VB 6 that has an edit box. In a c# .NET application
I put on a form the ActiveX and 2 text boxes. One text box is validated
and is called textBoxValidate d and the other one is not vaildated and
is called textBoxRegular (the regular text box is used to demonstrate
regular validating behaviour) . In this form, the first time you click
on the ActiveX, it works ok, but the 2nd time it doens't work ok
Here is the code of the form:

"
using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;

namespace WindowsApplicat ion5
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private AxProject1.AxUs erControl1 axUserControl11 ;
private System.Windows. Forms.TextBox textBoxValidate d;
private System.Windows. Forms.TextBox textBoxRegular;
/// <summary>
/// Required designer variable.
/// </summary>
private System.Componen tModel.Containe r components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeCompo nent();

//
// TODO: Add any constructor code after InitializeCompo nent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
System.Resource s.ResourceManag er resources = new
System.Resource s.ResourceManag er(typeof(Form1 ));
this.textBoxVal idated = new System.Windows. Forms.TextBox() ;
this.axUserCont rol11 = new AxProject1.AxUs erControl1();
this.textBoxReg ular = new System.Windows. Forms.TextBox() ;
((System.Compon entModel.ISuppo rtInitialize)(t his.axUserContr ol11)).BeginIni t();
this.SuspendLay out();
//
// textBoxValidate d
//
this.textBoxVal idated.Location = new System.Drawing. Point(448, 72);
this.textBoxVal idated.Name = "textBoxValidat ed";
this.textBoxVal idated.TabIndex = 2;
this.textBoxVal idated.Text = "validated text box";
this.textBoxVal idated.Validati ng += new
System.Componen tModel.CancelEv entHandler(this .textBox1_Valid ating);
//
// axUserControl11
//
this.axUserCont rol11.Enabled = true;
this.axUserCont rol11.Location = new System.Drawing. Point(128, 160);
this.axUserCont rol11.Name = "axUserControl1 1";
this.axUserCont rol11.OcxState =
((System.Window s.Forms.AxHost. State)(resource s.GetObject("ax UserControl11.O cxState")));
this.axUserCont rol11.Size = new System.Drawing. Size(320, 240);
this.axUserCont rol11.TabIndex = 3;
//
// textBoxRegular
//
this.textBoxReg ular.Location = new System.Drawing. Point(544, 152);
this.textBoxReg ular.Name = "textBoxRegular ";
this.textBoxReg ular.Size = new System.Drawing. Size(88, 20);
this.textBoxReg ular.TabIndex = 4;
this.textBoxReg ular.Text = "Regular text box";
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(824, 470);
this.Controls.A dd(this.textBox Regular);
this.Controls.A dd(this.axUserC ontrol11);
this.Controls.A dd(this.textBox Validated);
this.Name = "Form1";
this.Text = "Form1";
((System.Compon entModel.ISuppo rtInitialize)(t his.axUserContr ol11)).EndInit( );
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}

private void textBox1_Valida ting(object sender,
System.Componen tModel.CancelEv entArgs e)
{

MessageBox.Show ("DAN:(");
e.Cancel=true;
}

private void button1_Click(o bject sender, System.EventArg s e)
{
Application.Exi t();
}
}
}
"
Does any one know how to overcome this bug?

Thanks ,
Dan & Zeev.

Nov 17 '05 #1
0 1365

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2893
by: dw85745 | last post by:
PROBLEMS I Haven't solved: 1. Timing issue between real-time server #1 and my drawing tools. Will moving the tools (currently within module) to an ActiveX (exe or DLL) solve the problem or will the calls to the ActiveX in the mouse move event still result in a conflict???? Background
2
5358
by: Bill | last post by:
I have a VB6 ActiveX EXE app that generates events that I would like to handle in a C# application. The events in the VB app are defined like: Public Event SometingHappened(what As String) and raised like so: Public Sub EventNotification(ByVal what As String) RaiseEvent SometingHappened(what)
5
1632
by: Sagaert Johan | last post by:
hi I have the following problem: I have a C# application that uses an activeX . I installed the application and the NET 1.1 Runtimes on a clean pc When running the application i discover that the activeX events do not fire. I installed VS NET 2003 on that machine.(in an attempt to start debuggging) Now the activeX events fire again (application works as expected ).
4
4223
by: AIM48 | last post by:
Hi. We have a framework that we work with for our project. So far we have had very good success – basically the frame work wraps many day to day tasks so that they are all included in the project. The framework is built on a modified Page Controller pattern in which a aspx page controls the loading of clients (user controls) into a placeholder (Sort of similar to .net 2.0 Master Pages except that the page loads the client not the client...
5
2821
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For instance, using the IExtenderProvider interface, you can specify properties, but there is nothing documented about linking into a control's events. For instance, in my application, there are specific formatting, functionality and validation for...
0
1866
by: Peter | last post by:
I have a VB6 program which can receive Keydown events on an ActiveX control. The ActiveX control can't fire keydown events so I put a picturebox below the ActiveX control. I write codes in function picturebox_keydown in response to the keydown events on the ActiveX control. These can work well. But when I update these codes to vb.net I got a message 'UPGRADE_WARNING: PictureBox event Picture1.KeyDown can't be updated. Click to get more...
0
1276
by: swong4 | last post by:
Hi all, I am trying to use an ActiveX control on the server-side of an ASP.NET 2.0 application written in C#. The ActiveX control is a 3rd-party interface to a data feed used by my application and does not have a GUI. To accomplish this, I am trying to create a Windows.Form to host the ActiveX control with the intent that the events generated by the control could be used by the server for data processing.
23
3478
by: Galen Somerville | last post by:
A VB6 ActiveX.exe raises an event which is seen by the VB6 App. Same setup in VB2005. The event to be raised is in form frmSweep. As in VB6, frmSweep is hidden when the events take place. I know by actions on the screen and sounds in the speakers that VB2005 is using the ActiveX.exe correctly. However the events are never raised !!!
0
1371
by: miarfej | last post by:
Hi to all.. i am just new here, hoping to find some suggestions. I am writing a code in VC++. It is about creating an activeX control using MFC. This control exposes the properties and methods of another (hidden, we may say) activeX control using IDispatch implementations (GetIDsOfNames, and Invoke). I have no problem with these things. My problem is that, I need also to expose the events of the hidden activeX control. That is, my custom...
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.