0

ok heres what i got

Main.cpp

System::Void Form1::button1_Click(System::Object^ sender, System::EventArgs^ e) {

SetText("Hello, it's working");

}

System::Void Form1::SetText(String^ strText)

{

this->textBox1->Text = strText;

form1.h

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e);
	private: System::Void SetText(String^ strText);

What if I want to display the results of type double variables or int variables onto form1.h. instead of strings.

Edited by collinisaac: Left out info

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by jonsca
0

You can maybe convert double into String. and then display it. there are loads of ways to convert from int to string. using stringstreams etc. :)

Edited by Sky Diploma: n/a

0

You can concatenate the variables right onto a string:

double pi = 3.14159;
int i = 3;
MessageBox::Show(pi+" rounded down to the nearest integer is "+i);

If the object is not of one of the fundamental datatypes (int, double, etc) you will need to call it's ToString() method. The fundamental types have their own ToString() method but it's called implicitly (I believe) when you concatenate a number.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.