DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Victor Guest

    MSHFlexGrid: get column and row total?


    Dear VB Pros and Friends:

    Questions about MSHFlexGrid with VB6.

    adoRSAnalysis as ADODB.Recordset and has 5 fields, each is assigned to mshflexgrid
    from column 1 to 5.

    Column 1 is the ItemName, Columns 2 to 5 are the numbers, and Column 6 is
    the total for columns 2 to 5.

    Question 1: How to get the row total and show it on column 6?

    Question 2: how to get the column total for columns 2 to 5 on the last row
    (let¡¯s say, there are 20 records).

    They should look like this:

    ItemName Column1 ... ... Column5 Total
    Row1
    Row2
    ...
    ...
    Row20
    Total

    Column 6 and the last row with ¡°Total¡± are the run-time results.


    Thanks


  2. #2
    Trevor Guest

    Re: MSHFlexGrid: get column and row total?


    I'm not sure if this will work using ADO I've only used DAO..

    x = rows y = columns
    (total for each row)

    for x = 1 to 20
    for y = 1 to 5
    var1 = msgTextmatrix(x, y)
    var2 = var1 + var2
    next y
    msgTextMatrix(x, y+1) = var2
    next x

    (total for each column)

    for y = 1 to 5
    for x = 1 to 20
    var1 = msgTextMatrix(x, y)
    var2 = var1 + var2
    next x
    msgTextMatrix(x+1, y) = var2
    next y

    There's probably an easier way that I don't know about but this way should
    work


    "Victor" <victoryan88@yahoo.com> wrote:
    >
    >Dear VB Pros and Friends:
    >
    >Questions about MSHFlexGrid with VB6.
    >
    >adoRSAnalysis as ADODB.Recordset and has 5 fields, each is assigned to mshflexgrid
    >from column 1 to 5.
    >
    >Column 1 is the ItemName, Columns 2 to 5 are the numbers, and Column 6 is
    >the total for columns 2 to 5.
    >
    >Question 1: How to get the row total and show it on column 6?
    >
    >Question 2: how to get the column total for columns 2 to 5 on the last row
    >(let¡¯s say, there are 20 records).
    >
    >They should look like this:
    >
    >ItemName Column1 ... ... Column5 Total
    >Row1
    >Row2
    >...
    >...
    >Row20
    >Total
    >
    >Column 6 and the last row with ¡°Total¡± are the run-time results.
    >
    >
    >Thanks
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links