Error in argument ... of delegate constructor call 'System::EventHandler'

Hi,

I'm new to C++. I want to create an on-screen keyboard but unfortunately, i got 4 issues when i tried to run it. It tells me:

- class "Project1::MyForm" has no member "MyForm_Load"
- 'MyForm_Load': is not a member of 'Project1::MyForm'
- 'MyForm_Load': undeclared identifier
- error in argument #2 of delegate constructor call 'System::EventHandler':

Here's the line causing trouble:

this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);

What have I done wrong?
Thank you.
Last edited on
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
This looks fine. The problem seems that your form doesn't have a function called MyForm_Load.
Can you post the whole code?
Here it is.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once

namespace Project1 {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	public ref class MyForm : public System::Windows::Forms::Form
	{
	public:
		MyForm(void)
		{
			InitializeComponent();
		}

	protected:
		~MyForm()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  BEaigu;
	private: System::Windows::Forms::Button^  BEgrave;
	private: System::Windows::Forms::Button^  BEchap;
	private: System::Windows::Forms::Button^  BEtrema;
	protected:

	protected:

	private: System::Windows::Forms::Button^  Boe;
	private: System::Windows::Forms::Button^  Bae;
	private: System::Windows::Forms::Button^  BCedille;
	private: System::Windows::Forms::Button^  BOchap;
	private: System::Windows::Forms::Button^  BAchap;
	private: System::Windows::Forms::Button^  BAgrave;
	private: System::Windows::Forms::Button^  BIchap;
	private: System::Windows::Forms::Button^  BItrema;
	private: System::Windows::Forms::Button^  BUtrema;
	private: System::Windows::Forms::Button^  BUchap;
	private: System::Windows::Forms::Button^  BUgrave;

	private:
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		void InitializeComponent(void)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(MyForm::typeid));
			this->BEaigu = (gcnew System::Windows::Forms::Button());
			this->BEgrave = (gcnew System::Windows::Forms::Button());
			this->BEchap = (gcnew System::Windows::Forms::Button());
			this->BEtrema = (gcnew System::Windows::Forms::Button());
			this->Boe = (gcnew System::Windows::Forms::Button());
			this->Bae = (gcnew System::Windows::Forms::Button());
			this->BCedille = (gcnew System::Windows::Forms::Button());
			this->BOchap = (gcnew System::Windows::Forms::Button());
			this->BAchap = (gcnew System::Windows::Forms::Button());
			this->BAgrave = (gcnew System::Windows::Forms::Button());
			this->BIchap = (gcnew System::Windows::Forms::Button());
			this->BItrema = (gcnew System::Windows::Forms::Button());
			this->BUtrema = (gcnew System::Windows::Forms::Button());
			this->BUchap = (gcnew System::Windows::Forms::Button());
			this->BUgrave = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();

...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^>(resources->GetObject(L"$this.BackgroundImage")));
			this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
			this->ClientSize = System::Drawing::Size(457, 122);
			this->Controls->Add(this->BUgrave);
			this->Controls->Add(this->BUchap);
			this->Controls->Add(this->BUtrema);
			this->Controls->Add(this->BItrema);
			this->Controls->Add(this->BIchap);
			this->Controls->Add(this->BAgrave);
			this->Controls->Add(this->BAchap);
			this->Controls->Add(this->BOchap);
			this->Controls->Add(this->BCedille);
			this->Controls->Add(this->Bae);
			this->Controls->Add(this->Boe);
			this->Controls->Add(this->BEtrema);
			this->Controls->Add(this->BEchap);
			this->Controls->Add(this->BEgrave);
			this->Controls->Add(this->BEaigu);
			this->DoubleBuffered = true;
			this->Name = L"MyForm";
			this->Text = L"My Fucking Keyboard Helper";
			this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	};
};
Last edited on
Remove line 24
this->Load += gcnew System::EventHandler(this, &MyForm::MyForm_Load);

Topic archived. No new replies allowed.