Solved

sum selected cells in a datagridview

Posted on 2006-11-21
1
1,319 Views
Last Modified: 2010-05-18
Hi Experts

In VB 2005 I have a datagridview and I need to be able to sum selected cells and put the total into a textbox
can anyone help !

dizzycat
0
Comment
Question by:dizzycat
1 Comment
 
LVL 14

Accepted Solution

by:
Ramuncikas earned 250 total points
ID: 17986666
       Dim Total As Long = 0
        For Each Cell As DataGridViewCell In Me.DataGridView1.SelectedCells
            Total += Convert.ToInt64(Cell.Value)
        Next
        Me.TextBox1.Text = Total
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question