mardi 27 juillet 2021

Random String form array - Windows Forms c++ Visual Studio

I want, when I run the program, every button I've created (later buttons will be more) to have random String text from the array, which I've initialized. I don't know what I should do. The language is c++.

My array looks like this:

ising namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary> 
/// Summary for MyForm
/// </summary>
public ref class MyForm : public System::Windows::Forms::Form
{
public:
    MyForm(void)
    {
        InitializeComponent();
        //
        //TODO: Add the constructor code here
        //
        //KPoP Idols ARRAY Initializing
        KPoP_Idols = gcnew array<String^> {"Rose", "Yuna", "Momo", "Irene", "ChungHa", "Winter", "IU"};
    }
protected:
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    ~MyForm()
    {
        if (components)
        {
            delete components;
        }
    }
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ Timer;
private: System::Windows::Forms::Timer^ ShowButtonTextTimer;
private: System::Windows::Forms::Button^ button2;

 //KPoP Idols array Declaration
 array<String^>^ KPoP_Idols;



Aucun commentaire:

Enregistrer un commentaire