Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public Form1()
{
InitializeComponent();
dataGridView1.MultiSelect = false;
}
private void button1_Click(object sender, EventArgs e)
{
Elementi e1 = new Elementi()
{
Pera = "a",
Mika = "b",
Zika = "c"
};
Elementi e2 = new Elementi()
{
Pera = "x",
Mika = "y",
Zika = "d"
};
List<Elementi> x = new List<Elementi>();
x.Add(e1);
x.Add(e2);
dataGridView1.Columns["Pera"].Visible = false;
dataGridView1.Columns["Mika"].Visible = false;
dataGridView1.Columns["Zika"].Visible = false;
dataGridView1.DataSource = x;
}
private void button2_Click(object sender, EventArgs e)
{
label1.Text = dataGridView1.SelectedCells[0].Value.ToString();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.