Results 1 to 6 of 6

Thread: Does anyone have the answer to these 2 questions?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Does anyone have the answer to these 2 questions?

    Gentlemen:

    Does anyone have the answer to these 2 questions?

    1. How to sum only those records for the month of March in column 4 in datagrid1 and display it in a textbox3 located in a Tab Control #2 named “Ventas”
    2. How to sum ALL records in column 4 in datagrid1 and display it in textbox8 located in a Tab Control #2 named “Ventas”

    Thanks

    Andy

  2. #2
    Fanatic Member Redth's Avatar
    Join Date
    May 2001
    Location
    Ontario, Canada
    Posts
    551
    first things first... please try and post topics with more descriptive subject lines. Something like "Displaying Records in Datagrid" It's so much nicer to be able to tell what your question is about by glancing at the topic... and, it kind of gets some people frustrated and that will make them less likely to answer your questions.

    and for your actual questions:

    we need lots more information. like your database table structure, etc etc... you must provide enough information, otherwise nobody can help you...

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376
    Redth:



    You are right about this, I will write some code and repost, thanks.

    Andy


  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2003
    Posts
    376

    Do you know why I'm getting this error?

    Redth:

    Do you know why I'm getting this error?

    On this line:

    Code:
    If IsNumeric(Me.Item(row, col)) Then
    Error: Item is not a member of Project.frmMain'


    Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
            Dim ds As DataSet = Me.DsBrio250Table5
            'where "Me" is the datagrid
            Dim rowCount As Integer = ds.Tables(0).Rows.Count()
            Dim col As Integer = 4
            Dim row As Integer
            Dim dsum As Double
    
            For row = 0 To rowCount - 1
                If IsNumeric(Me.Item(row, col)) Then
                    dsum = dsum + CLng(IIf(IsDBNull(Me.Item(row, col)), "0", Me.Item(row, col)))
                End If
            Next row
        End Sub

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Maybe you mean this one (for the first error)
    VB Code:
    1. If IsNumeric(Me.DataGrid1.Item.Item(row, col)) Then

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    And btw , Me is reserved keyword . It represent the current instance of the form . Change it to something else .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width