zole_ria9
March 11th, 2010, 03:33 AM
How would you call a label (or panel, or etc) and then change its properties from another .h file?
Here's my code (snippet):
Form1.h
//let's assume that panel3 is already declared and there are no problem with it
#include "LinesDraw.h";
public ref class Form1 : public System::Windows::Forms::Form {
public: System::Windows::Forms::Label^ sample;
void InitializeComponent(void){
this->sample = (gcnew System::Windows::Forms::Label());
this->panel3->Controls->Add(this->sample);
}
}
LinesDraw.h
#include "Form1.h"
public class LinesDraw{
public:
//constructors and destructors here
void hello(){
Form1 f;
//here I tried putting f.sample; but it isn't working
//any idea on how I will call sample?
//and also how would I change its Text Property?
//is something like this ok?
//f.sample ->Text = L"Sample"
}
};
I want to call sample since I want to change its properties.
For example changing its Text property.
And also. this is just for curiosity but why is there an L in changing/declaring Text and Name property before the name itself?
Also, Form1.h is a managed form while LinesDraw.h is an unmanaged.
I wonder if its ok?? And if it is, how would I call a managed class using unmanaged class?
Any help would be appreciated.
Here's my code (snippet):
Form1.h
//let's assume that panel3 is already declared and there are no problem with it
#include "LinesDraw.h";
public ref class Form1 : public System::Windows::Forms::Form {
public: System::Windows::Forms::Label^ sample;
void InitializeComponent(void){
this->sample = (gcnew System::Windows::Forms::Label());
this->panel3->Controls->Add(this->sample);
}
}
LinesDraw.h
#include "Form1.h"
public class LinesDraw{
public:
//constructors and destructors here
void hello(){
Form1 f;
//here I tried putting f.sample; but it isn't working
//any idea on how I will call sample?
//and also how would I change its Text Property?
//is something like this ok?
//f.sample ->Text = L"Sample"
}
};
I want to call sample since I want to change its properties.
For example changing its Text property.
And also. this is just for curiosity but why is there an L in changing/declaring Text and Name property before the name itself?
Also, Form1.h is a managed form while LinesDraw.h is an unmanaged.
I wonder if its ok?? And if it is, how would I call a managed class using unmanaged class?
Any help would be appreciated.