I wonder how it is possible to retreive a string from a function that is generating this string.
How is it possible to get the string "SendThis" when presssing the button1 in this case and declare it to getgenerateString ?

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	String^ getgenerateString = ""; //How to get the string "SendThis" here ?
}

void generateString()
{
	String^ sendThisString = "SendThis";
}

Recommended Answers

All 2 Replies

What about calling the generateString function within your buttonclick function, except have generateString return the string instead of void

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	String^ getgenerateString = generateString(); 
}

String^ generateString()
{
	String^ sendThisString = "SendThis";
         return sendThisString;
}

Yes that was a good idéa, that is working great for the purpose.

Thanks for that !

What about calling the generateString function within your buttonclick function, except have generateString return the string instead of void

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
	String^ getgenerateString = generateString(); 
}

String^ generateString()
{
	String^ sendThisString = "SendThis";
         return sendThisString;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.