Set Text in a TextBox

in the automatically-generated Form1.h in MSVC 2010, how could I set the text of a textbox while the program is running?

the Form1.h looks something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{

.................................................................

			this->output->BackColor = System::Drawing::Color::White;
			this->output->Dock = System::Windows::Forms::DockStyle::Fill;
			this->output->Location = System::Drawing::Point(3, 16);
			this->output->Name = L"output";
			this->output->Size = System::Drawing::Size(267, 205);
			this->output->TabIndex = 0;
			this->output->Text = L">";
			this->output->TextAlign = System::Drawing::ContentAlignment::BottomLeft;

.................................................................


			// 
			// Form1
			// 
			this->AllowDrop = true;
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(584, 362);
			this->Controls->Add(this->splitContainer1);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->progressBar1);
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
			this->Name = L"Form1";
			this->Text = L"Prime Calc";
			this->groupBox1->ResumeLayout(false);
			this->splitContainer1->Panel1->ResumeLayout(false);
			this->splitContainer1->Panel1->PerformLayout();
			this->splitContainer1->Panel2->ResumeLayout(false);
			this->splitContainer1->Panel2->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->splitContainer1))->EndInit();
			this->splitContainer1->ResumeLayout(false);
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion 


and this is what I came up with:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Primes.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"
#include "math.h"

using namespace Primes;
using namespace std;


void print(char text)
{
	//right here I want this to change the text of the 'output' box
	//to the string carried by 'text'.  This is my non-working idea
	//based on Form1.h, and since my native programming language is
	//Lua, (more specifically, RBX.Lua) it appears to be perfectly
	//acceptable.
	Form1.output.Text=L"Hello";
}

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
	Application::EnableVisualStyles();
	Application::SetCompatibleTextRenderingDefault(false);
	Application::Run(gcnew Form1());

	print("hello");//not meant to pass the variable until it's figured out

	return 0;
}


Who can help?
Last edited on
Does no one know how to do this? It seems like a pretty simple thing to do to me.
It probably is. This is a C++ forum, though. The above code isn't C++.
@krakow10
In Form1.h there should be a line similar to this->output->Text=L""; in InitializeComponent() afaik you cant access the Form object since it is a temporary sent directly to Application::Run.
As you can see, this forum is hardly a good forum for C++/CLI. I don't really know how you guys end up asking questions here.

The best forum for C++/CLI is the MSDN Forums.
Thanks,
I'll show my big bundle of joy over there, and then ask them :)
Topic archived. No new replies allowed.