What I'm trying to do is change a textbox from the form1 from within the main '.cpp' file.
Basically, I want the text field to change on load. (Later it will be another reason).
Sorry if this is a dumb question. I'm a newbie.
I added the 2 lines in the Header file and changed the textbox from private to public. (guessing this isn't a good idea?)
Then I tried calling the change in the main function of the .cpp file.
Thank you so much for your help
.cpp file
#include "stdafx.h"
#include "Form1.h"
using namespace help;
[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());
namespace help {
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
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
static Form1^ myForm1; //Add this...
Form1(void)
{
InitializeComponent();
myForm1 = this; //added this...
//
//TODO: Add the constructor code here
//
}
protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
public: System::Windows::Forms::TextBox^ MyBox; //Changed To Public..
protected: