Solved

sum selected cells in a datagridview

Posted on 2006-11-21
1
1,303 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 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