Add together 2 DataGridView Cells (SUM)

Posted on 2006-05-03
Last Modified: 2011-04-14

I am trying to add together (SUM) two cells in my datagridview. For this example both my cells contain "45" ...I am trying the code below, but my result is "4545" instead of "90". How can I go about getting the sum of these two cells? I am not using a Dataset behind this datagridview. Thanks!

Total = (Me.DataGridView1.Rows(0).Cells(10).Value.ToString + Me.DataGridView1.Rows(1).Cells(10).Value.ToString)
Question by:kasowitz
    LVL 96

    Accepted Solution

    You are not adding values, but concatenating strings--don't use the ToString.


    Author Comment

    Perfect, Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now