C
C#11mo ago
Mattheo

winforms clr/c++ usercontrol issue

Hello everyone, I'm facing a tricky problem while developing an application in C++/CLR with WinForms in Visual Studio. When I try to display a UserControl in design view, I encounter the following error: MyUserControl.h :
c++
#pragma once

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

namespace userControl {

/// <summary>
/// Description résumée de MyUserControl
/// </summary>
public ref class MyUserControl : public System::Windows::Forms::UserControl
{
public:
MyUserControl(void)
{
InitializeComponent();
//
//TODO: ajoutez ici le code du constructeur
//
}

protected:
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
~MyUserControl()
{
if (components)
{
delete components;
}
}

private:
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
void InitializeComponent(void)
{
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}
c++
#pragma once

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

namespace userControl {

/// <summary>
/// Description résumée de MyUserControl
/// </summary>
public ref class MyUserControl : public System::Windows::Forms::UserControl
{
public:
MyUserControl(void)
{
InitializeComponent();
//
//TODO: ajoutez ici le code du constructeur
//
}

protected:
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
~MyUserControl()
{
if (components)
{
delete components;
}
}

private:
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
void InitializeComponent(void)
{
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
}
#pragma endregion
};
}
3 Replies
Mattheo
MattheoOP11mo ago
(default code generated by clr) I can send more code if it's needed The data needed to complete this operation is not yet available. (Exception from HRESULT: 0x8000000A) This error appears to be related to the generation of the DOM code in the visual design process. I have tried several solutions, such as repairing Visual Studio, checking references, disabling automatic code generation, but the problem persists. Can someone help me to fix it ? I'm a beginner Thank you in advance for your assistance.
Petris
Petris11mo ago
Why are you using C++/CLI for this?
Mattheo
MattheoOP11mo ago
Humm... idk 😂 Is C# better for winforms ?
Want results from more Discord servers?
Add your server