I need help making a label in Form2 = a textbox in Form1.
I keep getting the following errors.
c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2275: 'My7hund3r570rm::Form1' : illegal use of this type as an expression
1> c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\Form1.h(18) : see declaration of 'My7hund3r570rm::Form1'
1>c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2227: left of '->textBox3' must point to class/struct/union/generic type
1>c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2227: left of '->Text' must point to class/struct/union/generic type
1> 7hund3r570rm.cpp
1>c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2065: 'Form1' : undeclared identifier
1>c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2227: left of '->textBox3' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>c:\users\hamish\documents\visual studio 2010\projects\7hund3r570rm\7hund3r570rm\7hund3r570rmTextTest.h(29): error C2227: left of '->Text' must point to class/struct/union/generic type
My code:
#pragma once
#include "Form1.h"
namespace My7hund3r570rm {
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 My7hund3r570rmTextTest
/// </summary>
public ref class My7hund3r570rmTextTest : public System::Windows::Forms::Form
{
public:
My7hund3r570rmTextTest(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
this->label1->Text = Form1->textBox3->Text;
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~My7hund3r570rmTextTest()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;