How to Add Columns and Rows in the Datagridview in C#


AddDTGcolumsRowsfig.2sadasThis time, I’m going to teach you how to add columns and rows in the Datagridview programmatically using C#.Net. This is a step by step guide and easy to follow for adding columns and rows in the Datgridview. I will use Microsoft Visual Studio 2008 for my IDE


So, let gets started.


Step 1. Open Microsoft Visual Studio 2008 and Create a new windows form application.

Step 2. Add a Label and a Datagridview in the Form. See the figure1 as follows.

Figure 1.AddDTGcolumsRowsfig.1sadas

Step 3. Double-click the Form and do the following codes for adding Columns and Rows in the Datagridview.

Output :



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.