Technology and Online Community For All
welcome JOIN US NOW AND FEEL THE DIFFERENCE headbang

Technology and Online Community For All

What You See Is What You Get
 
HomeCalendarGalleryFAQSearchMemberlistUsergroupsRegisterLog in
July 2017
SunMonTueWedThuFriSat
      1
2345678
9101112131415
16171819202122
23242526272829
3031     
CalendarCalendar
Latest topics
» Uniblue PowerSuite
Mon Apr 09, 2012 7:27 pm by BlitzKrieG

» Ova Drive Hider
Fri Mar 02, 2012 8:48 am by CodeWarrior

» Ova Folder Security
Mon Feb 27, 2012 5:06 pm by CodeWarrior

» SPSBox
Sun Feb 26, 2012 4:24 am by CodeWarrior

» Norton [all here]
Thu Feb 23, 2012 8:01 am by BlitzKrieG

» OvaSystemSolution CVRS System
Sat Feb 18, 2012 6:06 am by CodeWarrior

» Avril Lavigne - Smile
Sat Jan 28, 2012 7:14 am by ^PiNKHeRMioNe

» Hot N Cold- Katy Perry
Sat Jan 28, 2012 7:11 am by ^PiNKHeRMioNe

» America's next top model (All Stars) Lisa D'Amato
Sat Jan 28, 2012 6:55 am by ^PiNKHeRMioNe

Search
 
 

Display results as :
 
Rechercher Advanced Search
Who is online?
In total there are 3 users online :: 0 Registered, 0 Hidden and 3 Guests

None

Most users ever online was 25 on Fri Dec 19, 2014 9:47 pm
Top posters
trekyboy
 
BlitzKrieG
 
ZNABiRA
 
EDI`STEALTH
 
*B o R g Z
 
SHY
 
CodeWarrior
 
^PiNKHeRMioNe
 
RaiJin
 
chaotic`
 
Similar topics
Statistics
We have 239 registered users
The newest registered user is Hellraiser666

Our users have posted a total of 949 messages in 663 subjects

Share | 
 

 TUT Calculate Value Field of DataBase

View previous topic View next topic Go down 
AuthorMessage
CodeWarrior
Code Master
Code Master


Join date : 2011-12-20
Male Posts : 22

20120102
PostTUT Calculate Value Field of DataBase

Sample you have an database with field name of Total

For Database get value of total sum for the cell
The "TotalAmount" is my Database Field

Code:

Private Sub btnTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotal.Click

        Try
            Dim totalSum As Integer

            For i As Integer = 0 To ds.Tables(0).Rows.Count - 1
                totalSum += ds.Tables(0).Rows(i).Item("TotalAmount")
            Next

            Label1.Text = "Total : " & totalSum.ToString()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
     
    End Sub

Sample
Juan Jan 230, Juan Mar 150, Juan Aug 320
Pedro Jan 120, Pedro Dec 380

For Individual contribute of person to display the total contribute
just type the name to textbox then click the button

Code:

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim Total As Integer = 0
        For i As Integer = 0 To DataGridView1.RowCount - 1
            If DataGridView1.Rows(i).Cells(1).Value = TextBox1.Text Then
                Total += DataGridView1.Rows(i).Cells(2).Value
            End If
        Next
        If Total = 0 Then
            MessageBox.Show("No Records Found")
        End If
        Label1.Text = Total
    End Sub
Back to top Go down
View user profile

 Similar topics

-
» how to select text from a disabled field?
» verify maximum length for a field using selenium IDE
» Gang Tag Database
» Windows 10 ESD Database Update Log
» Selenium RC; Permission denied on session.([error] Element not found ")
Share this post on: Excite BookmarksDiggRedditDel.icio.usGoogleLiveSlashdotNetscapeTechnoratiStumbleUponNewsvineFurlYahooSmarking

TUT Calculate Value Field of DataBase :: Comments

No Comment.
 

TUT Calculate Value Field of DataBase

View previous topic View next topic Back to top 

Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Technology and Online Community For All :: Technical Support :: Programming Related :: Visual Basic 6/VB.NET-
Jump to: