Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string[] lines = File.ReadAllLines(@"C:\Users\Admin\Desktop\Display.txt");
               string[] values;
               int i, j;
            //   dataGridView1.Rows.Clear();
               for (i = 0; i < lines.Length-5; i++)
               {
                   values = lines[i].ToString().Split();
                   string[] row = new string[values.Length];
                   for (j = 0; j <values.Length; j++)
                   {
                       row[j] = values[j].Trim();
                   }
                   table.Rows.Add(row);
               }
           }


What I have tried:

repeat the previous rows to be display into the next page of next row into the grid view
Posted
Updated 29-Jun-22 0:44am

1 solution

See answers here: How do I read/load a text file into my Datagridview[^]

The recommended way however is to use a bindingsource, see this CodeProject tutorial:
A Detailed Data Binding Tutorial[^]
 
Share this answer
 

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



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