Click here to Skip to main content
16,005,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
     dataGridView1.AutoGenerateColumns = true;

     dataGridView1.DataSource = from ar in arr
                                select ar;



When i execute the program datagridview does not show the select query
Posted

1 solution

Try:
C#
try
{
    int[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    dataGridView1.AutoGenerateColumns = true;

    BindingSource b = new BindingSource();
    b.DataSource = from ar in arr
                                select ar;
    dataGridView1.DataSource = b;
}
catch
{
// handle your own errors :)
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900