Link to home
Start Free TrialLog in
Avatar of Bae Chu
Bae Chu

asked on

Windows Forms C++ - Accessing Form Label Value From .cpp File

I'm making windows form called form2.h that has a trackbar and a label on it. I've pass the trackbar value to the label

System::Void trackBar1_Scroll(System::Object^  sender, System::EventArgs^  e) {
                        label2->Text = String::Concat( "", trackBar1->Value );
                   }

I also have a cpp file called form2.cpp and I want to use label2 from form2.h in my cpp file.
for example
string hmin = label2;
cout << hmin;

How do I do that? I already include things like

#include "StdAfx.h"
#include "Form2.h"
#include "stdio.h"
using namespace messagebox;

on top of the cpp file but I still cant use label2 element
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There was no feedback to the solution I posted. But since teh sample code originally comes from an MSDN sample, I have no doubts, that it would work if implemented as I described.

Sara