'Output the result of a function on a Label on a Form in Visual Studio 2022 C++

Using C++ in Visual Studio Code 2022 Forms, I want to create a random password generator and show it on a Label called lblOutput. But I'm new to C++ and Visual Studio Code, so I need some help to solve my problem.

I tried at first to do it with a simple number generator, but it doesn't even work.

Private: System::void btnGenerate_Click(System::Object^ sender, System::EventArgs^ e){
    std::list<int> liste; 
    for (int a = 1; a < 15, a++){
        int x = rand() % 99;
        liste.assign({x}); 
    }

    //lblOutput is the name of my label where I want to show the result of my function, so I tried this:
    lblOutput = gcnew System::String(liste);
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source