Tarek Madkour said:
Are you using MFC? Windows Forms? .NET
Can you post a small code sample that exhibits this bug?
File -> New -> Project -> Visual C++ Projects-> .NET-> Windows Forms
Application (.NET)
Name: = TestEvent <ENTER>
Switch to 'Form1.H' (View Code)
Edit -> Select All
Copy and paste the folling:-
------8<-------8<-----
#pragma once
namespace TestEvent
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System:
ata;
using namespace System:
rawing;
/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change
the
/// 'Resource File Name' property for the managed resource
compiler tool
/// associated with all .resx files this class depends on.
Otherwise,
/// the designers will not be able to interact properly with
localized
/// resources associated with this form.
/// </summary>
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
System::Void Button_MouseDown(System::Object * sender, MouseEventArgs *
e)
{
MessageBox::Show(S"",S"");
}
public: System::Windows::Forms::Button* button1;
Form1(void)
{
InitializeComponent();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super:
ispose(disposing);
}
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container * components;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->button1 = new System::Windows::Forms::Button();
this->SuspendLayout();
//
// button1
//
this->button1->Location = System:
rawing:
oint(24, 16);
this->button1->Name = S"button1";
this->button1->TabIndex = 0;
this->button1->MouseDown += new MouseEventHandler(this,
Button_MouseDown);
//
// Form1
//
this->AutoScaleBaseSize = System:
rawing::Size(5, 13);
this->ClientSize = System:
rawing::Size(292, 270);
this->Controls->Add(this->button1);
this->Name = S"Form1";
this->Text = S"Form1";
this->ResumeLayout(false);
}
};
}
------>8------->8-----
Now run the programme, and it should work OK
E.G. Clicking the blank button will display the OK MessageBox in
'Button_MouseDown'.
Now switch to the Form1.h [Design] mode and move the button now view the
code.
I'm finding that
this->button1->MouseDown += new MouseEventHandler(this, Button_MouseDown);
Is not there any more. ;-(
What am I doing wrong?
BIG thank you if you (or anyone else) can help me.
--
From _Christopher (M2M).
RefCode:333CdcTZCDdc V04
void DeadEnds() {for(;
;} //
If replying by email please included ##71; on the subject line followed by
your subject,
any post without the ##71; tag WILL be deleted. I.e. "##71; Thank for
the help."