vb 6 DataGrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skahala

    vb 6 DataGrid

    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


  • Scott

    #2
    Re: vb 6 DataGrid

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

    <%@ Language=VBScri pt %>
    <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>

    Comment

    Working...