How to Add Footer Row In DataGridView With Total In A Column in VB.Net

How to Add Footer Row In DataGridView With Total In A Column in VB.Net

This tutorial about “How to Add Footer Row In DataGridView With Total In A Column Project in VB.Net” will help you answer the problem regarding adding a total row in datagridview especially when you are doing a Sales Inventory Reports or summary. To start with this application, follow the steps provided below.

What is Visual Basic’s purpose?

The third-generation programming language was created to aid developers in the creation of Windows applications. It has a programming environment that allows programmers to write code in.exe or executable files. They can also utilize it to create in-house front-end solutions for interacting with huge databases. Because the language allows for continuing changes, you can keep coding and revising your work as needed.

However, there are some limits to the Microsoft Visual Basic download. If you want to make applications that take a long time to process, this software isn’t for you. That implies you won’t be able to use VB to create games or large apps because the system’s graphic interface requires a lot of memory and space. Furthermore, the language is limited to Microsoft and does not support other operating systems.

What are the most important characteristics of Visual Basic?

Microsoft Visual Basic for Applications Download, unlike other programming languages, allows for speedier app creation. It has string processing capabilities and is compatible with C++, MFC, and F#. Multi-targeting and the Windows Presentation Framework are also supported by the system, allowing developers to create a variety of Windows apps, desktop tools, metro-style programs, and hardware drivers.

How to Add Footer Row In DataGridView With Total In A Column

Step 1: Create a Visual Basic Project

  • Open Visual Basic 2008/2010, and Create a new project
  • Save it as “FooterRow.”

Step 2: Design the Form

  • Add 1 DataGridview and a Button
  • Then Follow the Design show below.

add footer row

add footer row

Step 3: Adding of Codes

  • we are going to Populate the datagridview with Data to do this, Double click the form and on the Form1_Load add the following code.
DataGridView1.Rows.Add("Joken", 3, 7.5, 22.5)
DataGridView1.Rows.Add("Batuto", 1, 8, 8)
DataGridView1.Rows.Add("Intong", 2, 20, 40)
DataGridView1.Rows.Add("Sansolis", 3, 4, 12)
DataGridView1.Rows.Add("Peter", 5, 4.25, 21.25)


  • Next, to compute the total, we to use a loop that will read and Get the total Sales. To do this, Double click the Button and add the Following Code.
Dim total As Double
For i As Integer = 0 To DataGridView1.RowCount - 1
total += DataGridView1.Rows(i).Cells(3).Value
DataGridView1.Rows.Add(Nothing, Nothing, "Total", total)


Step 4: Run the Project.

  • Press F5
  • or, Click the Play Button

The running Program looks like, as shown below:

add footer row1
Add footer row1

Note* You can do this using data from the database.

If you have any questions or suggestion, please feel free to drop a message at our contact page.


Download the full source code here:

Related Article you may like:

If you have any questions or suggestions about this management system project or How to Add Footer Row In DataGridView With Total In A Column in VB.Net, just send your inquiry using our contact page or simply leave a comment below.

Leave a Comment