winforms c++ : how to change textbox or any other component in one form from other form RRS feed

  • Question

  • I am in a very crucial point in my work project, and I must get some help.

    i followed and researched every way online, but without any working result.

    in general, I need to update components that are located in one form from another form - and I need to do it with several components (it can be a textbox, a webview2 component).

    in MyForm.h:

    this->txtBoxLogText->AcceptsReturn = true;
    this->txtBoxLogText->Location = System::Drawing::Point(288, 409);
    this->txtBoxLogText->Multiline = true;
    this->txtBoxLogText->Name = L"txtBoxLogText";
    this->txtBoxLogText->Size = System::Drawing::Size(580, 300);
    this->txtBoxLogText->TabIndex = 37;

    in cameraSetup.h (the other form):

    Calc::MyForm dsg;
    //MyForm f1;}

    in the relevant component/event i decalired this:

    System::Void Calc::cameraSetup::btnConnectVideoFeedLan_Click(System::Object^ sender, System::EventArgs^ e)
    Calc::MyForm::txtBoxLogText df;
        this->dsg.webView21->Source = (gcnew System::Uri(L"http://www.google.com", System::UriKind::Absolute));

    this doesn't have any affect.

    other attempts:

    in txtBoxLogText Ii have changed modifier to public. then i tryied accesing it from the CameraSetup.h form - but it is undifined.

    I tried to follow and implement some c# very simple solutions, but again, nothing worked.

    please, if you can show me a way to do so, it will help me continue the project.

    I must say that I am a c developer and not c++. the only reason I'm using c++ is the GUI (next time I will make it in c#), so I have very basic knowledge in C++.

    Saturday, September 26, 2020 10:48 AM


All replies