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. Advertising

  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. Advertising

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:
    475
  2. BK Kim

    datagrid in datagrid

    BK Kim, Feb 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    571
    Alvin Bruney [MVP]
    Mar 2, 2004
  3. =?Utf-8?B?U3VyZXNo?=
    Replies:
    0
    Views:
    546
    =?Utf-8?B?U3VyZXNo?=
    Mar 2, 2004
  4. Brian K. Williams
    Replies:
    0
    Views:
    561
    Brian K. Williams
    Mar 2, 2004
  5. Andreas Klemt
    Replies:
    0
    Views:
    334
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page