S
S
Sergey Korenevsky2020-11-12 05:11:14
C++ / C#
Sergey Korenevsky, 2020-11-12 05:11:14

How to bind array of strings to DataGridView (WinForms) using DataSource, DataPropertyName properties?

private void Form1_Load(object sender, EventArgs e)
{
    dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { DataPropertyName = "{}" });
    dataGridView1.DataSource = new [] { "One", "Two", "Three", "Four" };
}

Everywhere the values ​​in the cells are empty.
How to make it so that the values ​​are data from an array?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question