using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace andmed1 { public partial class Form1 : Form { DataTable dt = new DataTable(); public Form1() { InitializeComponent(); dt.Columns.Add("eesnimi"); dt.Columns.Add("synniaasta"); } private void button1_Click(object sender, EventArgs e) { DataRow dr = dt.NewRow(); dr["eesnimi"] = "Juku"; dr["synniaasta"] = "1889"; dt.Rows.Add(dr); dataGridView1.DataSource = dt; } private void button2_Click(object sender, EventArgs e) { textBox1.Text = dt.Rows.Count.ToString() + dt.Rows[1].ItemArray[0]; } } }