I have Form1 and Form2 in my project. On Form1 I open Form2 like this:

Form2^form2 = gcnew Form2;
form2->Show();

In the Form2:s LoadEvent I use this code so this Form2 will be Active/Shown even that I click on Form1:

private: System::Void Form2_Load(System::Object^  sender, System::EventArgs^  e) 
{
    Form2::TopMost::set(true);
}

Now is my question this. If I have a textBox1 on Form2 with a written text inside. How can it be possible to reach this text from a button on Form1.

Usually you could have written like this if the textBox was on Form1 in this case:

String^ GetText = textBox1->Text;

I do recall reading one of your threads that asked basically the same question and received a good answer (an answer which would solve your current similar problem). Perhaps you should take the time to learn the concepts of the answers you're given rather than just slapping the example code into your project and hacking it into submission.

I am not sure if you could meen that I can get the String from Form2, beginning with the
FormClass and then the textBox like this.
I can find the richTextBox1 as a member and I have declared the richTextBox as public on Form2:
If I write the first example. The compiler says.
left of '->Text' must point to class/struct/union/generic type

#include "Form2.h"
String^ GetText = Form2::richTextBox1->Text;

I do recall reading one of your threads that asked basically the same question and received a good answer (an answer which would solve your current similar problem). Perhaps you should take the time to learn the concepts of the answers you're given rather than just slapping the example code into your project and hacking it into submission.

>I am not sure if you could meen that I can get the String from Form2
What I mean is that you need to engage your brain around here, because you've been told how to pass data between two forms before: use properties or events. Generally, if you ask the same question multiple times, we assume you're nothing but a mindless leech looking for quick answers, and nobody will want to help you.

>I have declared the richTextBox as public on Form2
That's about the worst possible solution. If you have to make private data public, you're doing something wrong.

>> we assume you're nothing but a mindless leech looking for quick answers

I beleive it is important that I mention something here. I am not looking for quick answers.
If I have passed data between forms before I would be happy to know what question that was because I have left out this question for 2 months. The only things I do is to read and write to files.
This is the only way I communicate between the Forms, passing strings and text right now through textfiles.
For the moment I dont know any other way.
Perheps I have done this or something simular in a way I haven´t thought of ofcourse.
I will check the properties and events now and it could be a good way as you say to experiment around and see if I can solve it myself. I will do this.
One way I know I can do is to to use the event Text_Changed that writes all contents to a file each time you write something and then I can read this file.

j

>I am not sure if you could meen that I can get the String from Form2
What I mean is that you need to engage your brain around here, because you've been told how to pass data between two forms before: use properties or events. Generally, if you ask the same question multiple times, we assume you're nothing but a mindless leech looking for quick answers, and nobody will want to help you.

>I have declared the richTextBox as public on Form2
That's about the worst possible solution. If you have to make private data public, you're doing something wrong.

>I am not looking for quick answers.
So slow ones will do? ;)

>If I have passed data between forms before I would be happy to know what
>question that was because I have left out this question for 2 months.
I remember reading a thread where a public property in one form allowed another form to get private data. You're one of the few people who asks about C++/CLI on this forum, and I'm pretty sure it was you, though I could be wrong.

>This is the only way I communicate between the Forms,
>passing strings and text right now through textfiles.
Read up on properties. I can only mention it so many times before I get tired of my advice being ignored.

Thanks Narue, I will read the properties and also my previous posts to see if I can find anything. I dont want to be to sure myself either :-/ and really understand its tiring to answer the same questions.

I found one thread where I did ask how to declare a managed vector to be reached from two buttoncontrols. I would fill the vector from one buttoncontrol on the form and the second buttoncontrol on the same form would read the contents that the vector stored.
I am not really sure about the meening with private and public so I just wrote public like below.
So I had to declare it in managed because it had to be declared ´outside´ the buttoncode.
This I remember I asked but this perheps wasn´t the one.

public: System::Collections::Generic::List<double> OneVector;

>I am not looking for quick answers.
So slow ones will do? ;)

>If I have passed data between forms before I would be happy to know what
>question that was because I have left out this question for 2 months.
I remember reading a thread where a public property in one form allowed another form to get private data. You're one of the few people who asks about C++/CLI on this forum, and I'm pretty sure it was you, though I could be wrong.

>This is the only way I communicate between the Forms,
>passing strings and text right now through textfiles.
Read up on properties. I can only mention it so many times before I get tired of my advice being ignored.

This article has been dead for over six months. Start a new discussion instead.