Array List Kullanımı

Array List Kullanımı
Örnek
using System;
using System.Collections;
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 WindowsFormsApp38
{
    public partial class Form1 : Form
    {
        ArrayList Tutucu = new ArrayList();

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            
        }

        public void Ms(string Mesaj)
        {
            MessageBox.Show(Mesaj);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                int ElemanNumarasi = Convert.ToInt16(numericUpDown1.Value);

                Ms("Deger: " + Tutucu[ElemanNumarasi]);
            }
            catch
            {
                Ms("Yanlış index girildi");
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Tutucu.Add(textBox1.Text); 
                ElemanSayisiGoster();
                textBox1.Clear();
            }
            catch
            {
                Ms("Lütfen değer girin");
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                int ElemanNumarasi = Convert.ToInt16(numericUpDown1.Value);
                Tutucu.RemoveAt(ElemanNumarasi);
                ElemanSayisiGoster();
            }
            catch
            {
                Ms("Lütfen geçerli değer girin");
            }
        }

        public void ElemanSayisiGoster()
        {
            label1.Text = Tutucu.Count.ToString();
        }
    }
}
Yükleniyor...
Yükleniyor...