26 - İki Boyutlu Dizi Örneği : Seçimli Oyun
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string[,] oyun = new string[2, 3];
int index = 0;
private void button1_Click(object sender, EventArgs e)
{
oyun[index, 0] = comboBox2.SelectedItem.ToString();
oyun[index, 1] = comboBox3.SelectedItem.ToString();
oyun[index, 2] = comboBox4.SelectedItem.ToString();
index++;
}
int bolum = 1;
private void button2_Click(object sender, EventArgs e)
{/*
foreach (var item in oyun)
{
listBox1.Items.Add(item);
} */
for (int i = 0; i < 2; i++)
{
listBox1.Items.Add("Bölüm "+bolum);
for (int j = 0; j < 3; j++)
{
listBox1.Items.Add(oyun[i, j]);
}
bolum++;
}
}

Yorumlar
Yorum Gönder