[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
/// <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 ref class Form1 : public System:: Windows:: Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
#pragma once
namespace CLRW2 {
ref class SData
{
public :
SData(){}
}; // public ref class SourceData : public System::Object
ref class Form1;
usingnamespace System;
usingnamespace System::ComponentModel;
usingnamespace System::Collections;
usingnamespace System::Windows::Forms;
usingnamespace System::Data;
usingnamespace System::Drawing;
/// <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 ref class Form1 : public System:: Windows:: Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
protected:
private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel:: Container ^components;
#pragma 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>
void InitializeComponent(void)
{
this->SuspendLayout();
//
// Form1
//
this->AutoScaleDimensions = System:: Drawing:: SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System:: Drawing:: Size(478, 310);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System:: EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
private: System:: Void Form1_Load(System:: Object^ sender, System::EventArgs^ e) {
CLRW2::SData^ ptrSData = gcnew CLRW2::SData();
}
};
}
Do not worry dear boys (or girls) Danielm103 and Grey Wolf, do not be angry too, but if I use your advice(opinion) I am not able to use Designer. Designer said me, it is not able to find "ref class Form1;"
Newer mind.
I have
MS Visual studio 2008, version 9.0.30729.1SP, .NET 3.5
It is highly probably, I have a bad version of Visual studio.
:-)
Do you "anybody" know "stdafx.h" ?
I would like to know, why did you to adviced me badly?
It does nto sense.
Well, in that case create a header file for your SData class and include it in the stdafx header.
1 2 3 4 5 6 7 8
namespace CLRW2 {
public ref class SData
{
public :
SData(){}
}; // public ref class SourceData : public System::Object
}
data.h
1 2 3 4 5 6 7
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once
// TODO: reference additional headers your program requires here
#include "data.h"
#pragma once
namespace CLRW2 {
ref class Form1;
usingnamespace System;
usingnamespace System::ComponentModel;
usingnamespace System::Collections;
usingnamespace System::Windows::Forms;
usingnamespace System::Data;
usingnamespace System::Drawing;
/// <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 ref class Form1 : public System:: Windows:: Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
...
form1.h
I would like to know, why did you to adviced me badly?
Dear girls Danielm103 and Grey Wolf (or boys?).
Your last reply seems to be OK.
But, a right programmer boy is clever evrythime.
Not in "Mar 31, 2009 at 8:35pm" only. :-)