Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem displaying text in richtextbox

Status
Not open for further replies.

myuserid7

MIS
Mar 2, 2005
111
ES
Hello guys,

I'm just a newbie as far as VS2005 and winforms go, so please bear with me on this question. I'm implementing a windows forms application that has tab controls and one of the tabpage containing a rich text box. I have a public function in "Form1.h" that takes in a string as input and outputs it to the text box.



public:

property String^ AppendValue // PassedValue property

{
void set(String ^value)
{
// MessageBox::Show(value, "test", MessageBoxButtons::OK, MessageBoxIcon::Information);

this->outputText->AppendText(value);
}
}


Now, I have a main.cpp file that runs this Form1 application. I have this function in main.cpp that does some test matrix generation work and then needs to output its results to this text box. Here is that function -


void SendOutput(String^ rstr)
{
Form1 myObj;
myObj.AppendValue::set(rstr);
}


The problem is "rstr" doesnt get displayed on the output text box. I have included the namespace from Form1 and everything compiles fine too. I just cant seem to figure out whats going wrong. Could anybody please help me understand how to fix this problem??

One interesting thing I have noticed is that I can output to the rich text box from functions within Form1 but when it comes to any function outside this file Form1.h trying to send strings to the text box..doesnt work.

Thanks in advance!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top