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);
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??
I'm guessing it has something to do with creating the correct instance
of Form1. Thoughts anybody??
Thanks in advance!!
Dave Sexton - 08 Jul 2006 02:44 GMT
Hi Havish,
Could it be a Threading issue? Make sure you use Form1.Invoke if you are
calling SendOutput from a non-UI thread.
What does your AppendText method do? The problem could be in that method.
> I'm guessing it has something to do with creating the correct instance
> of Form1. Thoughts anybody??
How many instances of Form1 are created in code? It should probably be just
one, I'd imagine.
HTH
> Hello guys,
>
[quoted text clipped - 37 lines]
>
> Thanks in advance!!