Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String multi-dimensional arrays
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
String multi-dimensional arrays
Versions des environnements
Environment:
C# 3.0
Database:
Visual FoxPro
Divers
Thread ID:
01464631
Message ID:
01464631
Vues:
110
Is there any way to easily fill a ListBox from a 2-dimensional array? This is so much easier to do in Visual FoxPro.

I am simply trying to fill a ListBox control in C# (VS2008) from a 2-dimensional array. I would like to only use the 0 column (Far left). The array is used elsewhere as a reference table. But, I'd like to at least fill the ListBox with the first column of data from the array.

My array is filled with data at the class level and is called _crossRefArray. It is declared as follows:
namespace ChristophersCarCenter
{
    public partial class ChristophersCarCenterForm : Form
    {
        string[,] _crossRefArray = new string[9, 4]
            {   
                {"PR214","MR43T","RBL8",   "14K22"},
                {"PR223","R43",  "RJ6",    "14K24"},
                {"PR224","R43N", "RN4",    "14K30"},
                {"PR246","R46N", "RN8",    "14K32"},
                {"PR247","R46TS","RBL17Y", "14K33"},
                {"PR248","R46TX","RBL12-6","14K35"},
                {"PR324","S46",  "J11",    "14K38"},
                {"PR326","SR46E","XEJ8",   "14K40"},
                {"PR444","47L",  "H12",    "14K44"}
            };
        
        public ChristophersCarCenterForm()
        {
            InitializeComponent();
        }

        private void ChristophersCarCenterForm_Load(object sender, EventArgs e)
        {
            CCCListBox.Items.AddRange(_crossRefArray);  // <<<---THIS ISN'T WORKING.
        }

        private void exitButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
It is more simple, I think, to fill a ListBox control in Visual FoxPro than it is in C#.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform