vb 6 DataGrid

Discussion in 'ASP General' started by skahala, Sep 14, 2004.

  1. skahala

    skahala Guest

    Dear Sir ,

    I am displaying Amount in DataGrid in a column called
    Total. I want to calculate Grand Total and display it in a
    text box how do i loop through DataGrid to Claculate the
    Grand Total.

    thanx
     
    skahala, Sep 14, 2004
    #1
    1. Advertisements

  2. skahala

    Scott Guest

    Copy and paste this into a new asp page, and hopefully you will get
    the general idea:

    <%@ Language=VBScript %>
    <HTML>
    <HEAD></HEAD>
    <BODY>
    <TABLE BORDER=1>
    <%
    Dim oItems, oTot
    oTot = 0
    oItems = 3 'Make this equal to the # of items RS1.RecordCount
    For i = 1 To oItems
    oTot = oTot + 5 'Make this equal to RS1("ItemValue")
    %>
    <TR>
    <TD>Item <%=i%></TD>
    <TD><%="5"%><%'Make this equal to RS1("ItemValue")%></TD>
    </TR>
    <%
    Next
    %>
    <TR>
    <TD>Total Items</TD>
    <TD><%=oItems%></TD>
    </TR>
    <TR>
    <TD>Total Cost</TD>
    <TD><%=oTot%></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
     
    Scott, Sep 15, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    0
    Views:
    607
  2. BK Kim

    datagrid in datagrid

    BK Kim, Feb 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    742
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. Amar
    Replies:
    0
    Views:
    648
  4. matthew schouppe
    Replies:
    3
    Views:
    2,523
    Scott Allen
    Apr 30, 2004
  5. Patrick Delifer

    Updating Datagrid from outside datagrid

    Patrick Delifer, May 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    414
    Natty Gur
    May 4, 2004
  6. RSB
    Replies:
    2
    Views:
    1,354
  7. Martin Marinov
    Replies:
    2
    Views:
    5,693
  8. Andreas Klemt
    Replies:
    0
    Views:
    491
    Andreas Klemt
    Oct 8, 2003
Loading...