Click here to Skip to main content
15,894,180 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: How do I make a managed c++ struct that will be usable in c# as an array, while still being able to be passed to unmanaged c++ as an array? [modified] Pin
Paul Michalik3-Jun-10 2:35
Paul Michalik3-Jun-10 2:35 
QuestionSerialization problem Pin
roshihans20-May-10 21:05
roshihans20-May-10 21:05 
Questiona little help ,find a word from text Pin
Gilbertu19-May-10 10:43
Gilbertu19-May-10 10:43 
AnswerRe: a little help ,find a word from text Pin
Luc Pattyn19-May-10 14:05
sitebuilderLuc Pattyn19-May-10 14:05 
AnswerRe: a little help ,find a word from text Pin
T210215-Jun-10 21:26
T210215-Jun-10 21:26 
QuestionGet the button click event from another form Pin
rikterveen18-May-10 20:46
rikterveen18-May-10 20:46 
GeneralRe: Get the button click event from another form Pin
Andreoli Carlo18-May-10 21:56
professionalAndreoli Carlo18-May-10 21:56 
GeneralRe: Get the button click event from another form Pin
rikterveen20-May-10 7:16
rikterveen20-May-10 7:16 
OK, i wrote a little test program which does the same.

#pragma once

#include "form2.h"

namespace Test2 {

	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 Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
		}

	protected:
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Button^  testbutton;
	private: System::Windows::Forms::Label^  testlabel;
	private: System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code


	public:
		void InitializeComponent(void)
		{
			this->testbutton = (gcnew System::Windows::Forms::Button());
			this->testlabel = (gcnew System::Windows::Forms::Label());
			this->SuspendLayout();

			/* Testbutton */
			this->testbutton->Location = System::Drawing::Point(12, 326);
			this->testbutton->Name = L"button_test";
			this->testbutton->Size = System::Drawing::Size(75, 23);
			this->testbutton->TabIndex = 0;
			this->testbutton->Text = L"Test";
			this->testbutton->UseVisualStyleBackColor = true;
			this->testbutton->Click += gcnew System::EventHandler(this, &Form1::testbutton_click);
			// 
			// testlabel
			// 
			this->testlabel->AutoSize = true;
			this->testlabel->Location = System::Drawing::Point(9, 19);
			this->testlabel->Name = L"label_test";
			this->testlabel->Size = System::Drawing::Size(35, 13);
			this->testlabel->TabIndex = 1;
			this->testlabel->Text = L"";
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(382, 361);
			this->Controls->Add(this->testlabel);
			this->Controls->Add(this->testbutton);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->ResumeLayout(false);
			this->PerformLayout();

			/*  Code form the button on other form */
			Form2^ popup = gcnew Form2();
			popup->button_send->Click += gcnew System::EventHandler(this, &Form1::raised_event);

		}
	private:
#pragma endregion




	private: System::Void testbutton_click(System::Object^  sender, System::EventArgs^  e) {
				 testlabel->Text = "new form open";

				 Form2^ popup = gcnew Form2();
				 popup->ShowDialog();
			 }

	private: void raised_event (System::Object^  sender, System::EventArgs^  e)
			 {
				 /* Get the text from the textbox on the other form */
				 Form2^ popup = gcnew Form2();
				 testlabel->Text = popup->textbox->Text;
			 }
	};
}



Form2

#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 Test2 {
	public ref class Form2 : public System::Windows::Forms::Form
	{
	public:
		Form2(void)
		{
			InitializeComponent();
		}

	protected:
		~Form2()
		{
			if (components)
			{
				delete components;
			}
		}
	public: System::Windows::Forms::RichTextBox^  textbox;
	protected: 
	public: System::Windows::Forms::Button^  button_send;

	protected: 

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

#pragma region Windows Form Designer generated code
		void InitializeComponent(void)
		{
			this->textbox = (gcnew System::Windows::Forms::RichTextBox());
			this->button_send = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();
			// 
			// textbox
			// 
			this->textbox->Location = System::Drawing::Point(12, 12);
			this->textbox->Name = L"textbox";
			this->textbox->Size = System::Drawing::Size(268, 147);
			this->textbox->TabIndex = 0;
			this->textbox->Text = L"";
			// 
			// button_send
			// 
			this->button_send->Location = System::Drawing::Point(12, 165);
			this->button_send->Name = L"button_send";
			this->button_send->Size = System::Drawing::Size(75, 23);
			this->button_send->TabIndex = 1;
			this->button_send->Text = L"Send";
			this->button_send->UseVisualStyleBackColor = true;
			// 
			// Form2
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(292, 198);
			this->Controls->Add(this->button_send);
			this->Controls->Add(this->textbox);
			this->Name = L"Form2";
			this->Text = L"Form2";
			this->Load += gcnew System::EventHandler(this, &Form2::Form2_Load);
			this->ResumeLayout(false);

		}
#pragma endregion
	private: System::Void Form2_Load(System::Object^  sender, System::EventArgs^  e) {
				 textbox->Text = "hoi";

			 }
	};
}

AnswerRe: Get the button click event from another form [modified] Pin
Andreoli Carlo20-May-10 23:14
professionalAndreoli Carlo20-May-10 23:14 
GeneralRe: Get the button click event from another form Pin
rikterveen27-May-10 20:44
rikterveen27-May-10 20:44 
GeneralRe: Get the button click event from another form Pin
Andreoli Carlo31-May-10 12:01
professionalAndreoli Carlo31-May-10 12:01 
AnswerRe: Get the button click event from another form Pin
voo doo125-Jun-10 6:24
voo doo125-Jun-10 6:24 
Questionnot able to built project in release mode Pin
sharada veena17-May-10 19:26
sharada veena17-May-10 19:26 
Questionhelp vc++.net Pin
Gilbertu17-May-10 0:22
Gilbertu17-May-10 0:22 
AnswerRe: help vc++.net Pin
Richard MacCutchan17-May-10 1:26
mveRichard MacCutchan17-May-10 1:26 
Question[] symbol appears in string when reading from / writing to file Pin
KlaasVersteeg16-May-10 23:57
KlaasVersteeg16-May-10 23:57 
QuestionSizeof out of scope? Pin
Xpnctoc8-May-10 6:39
Xpnctoc8-May-10 6:39 
AnswerRe: Sizeof out of scope? Pin
Michel Godfroid8-May-10 8:48
Michel Godfroid8-May-10 8:48 
AnswerRe: Sizeof out of scope? Pin
Richard MacCutchan8-May-10 8:59
mveRichard MacCutchan8-May-10 8:59 
AnswerRe: Sizeof out of scope? Pin
Xpnctoc8-May-10 17:54
Xpnctoc8-May-10 17:54 
GeneralRe: Sizeof out of scope? Pin
Michel Godfroid8-May-10 20:15
Michel Godfroid8-May-10 20:15 
GeneralRe: Sizeof out of scope? Pin
Xpnctoc9-May-10 12:18
Xpnctoc9-May-10 12:18 
GeneralRe: Sizeof out of scope? Pin
Richard MacCutchan9-May-10 22:12
mveRichard MacCutchan9-May-10 22:12 
GeneralRe: Sizeof out of scope? Pin
Xpnctoc10-May-10 4:30
Xpnctoc10-May-10 4:30 
GeneralRe: Sizeof out of scope? Pin
Richard MacCutchan10-May-10 5:15
mveRichard MacCutchan10-May-10 5:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.