Skip to content

Instantly share code, notes, and snippets.

@mzdv
Created June 1, 2016 12:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mzdv/af9de0b9221cc3eca4452db3f6a9b033 to your computer and use it in GitHub Desktop.
Save mzdv/af9de0b9221cc3eca4452db3f6a9b033 to your computer and use it in GitHub Desktop.
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