Custom controle not working (VS2012)

Hi

i'm trying to add a custom control to my project. after i compile i can see it in my toolbox but when i add it VS gives me this error:

---------------------------
Microsoft Visual Studio
---------------------------
Failed to load toolbox item 'myPanel'. It will be removed from the toolbox.
---------------------------
OK
---------------------------

my code for the panel
1
2
3
4
5
6
7
8
9
10
11
12
#pragma once
using namespace System;
using namespace System::Windows::Forms;

public ref class myPanel : public Panel {
public:
	myPanel() : Panel() {
		SetStyle(ControlStyles::DoubleBuffer, true);
		SetStyle(ControlStyles::UserPaint, true);
		SetStyle(ControlStyles::AllPaintingInWmPaint, true);
	};
};


if i manually edit the code and run the program, then the panel works just fine.
1
2
3
myPanel^  mPanel = gcnew myPanel();
mPanel->Dock = System::Windows::Forms::DockStyle::Fill;
this->toolStripContainer1->ContentPanel->Controls->Add(mPanel);


any idea what i'm doing wrong?
Last edited on
Topic archived. No new replies allowed.