18 - Dizi Örneği 1

 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 WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

       string[] turler = new string[4];

       int i = 0;

        private void button1_Click(object sender, EventArgs e)

        {

            turler[i] = textBox1.Text;

            i++;

            textBox1.Text = "";

        }


        private void button2_Click(object sender, EventArgs e)

        {

         /*   listBox1.Items.Add(turler[0]);

            listBox1.Items.Add(turler[1]);

            listBox1.Items.Add(turler[2]);

            listBox1.Items.Add(turler[3]);

            */

         /*   for (int i = 0; i < turler.Length; i++)

            {

                 listBox1.Items.Add(turler[i]);

            }*/


            foreach (string item in turler)

            {

                listBox1.Items.Add(item);

            }

        }

    }

}


Yorumlar

Bu blogdaki popüler yayınlar

14 - Dizi Oluşturma, Değer Atama

12 - Bir Boyutlu Diziler - Çalışma Soruları

27 - Koleksiyonlar: ArrayList()