lundi 14 décembre 2020

how do i make it so that instead of names already being in the array that the user has to input names into the array?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace namegenerator1._2
{
    public partial class Form1 : Form
    { 
        string[] FirstNames = { "jan", "jaap", "sjuul", "koen" };
        
        Random rand = new Random();

        public Form1()
        {
            InitializeComponent();
        }

        private void btn_generate_Click(object sender, EventArgs e)
        {
            int indexFirstName = rand.Next(FirstNames.Length);

            this.txtbox_FirstName.Text = FirstNames[indexFirstName];
        }
    }
}

thid basicly makes a little box that generates random names from the array, i need to make it so that before the user gets to that he needs to put in a bunch of names himself. which i dont know how to do.




Aucun commentaire:

Enregistrer un commentaire