Results 1 to 4 of 4

Thread: updating data grid values

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    25
    I have a datagrid with 3 columns. The program loops through and subtracts the value in column 3 from column 2 and puts the answer in column 1 until it reaches the end of the file.

    The problem is, it doesnt actually put the answer in column 1, or at least it is not visible. How do I get Vb to show the result of the caluculation in the columm?

    thanks in advance.
    If you reach total enlightenment while drinking a beer, I bet it makes beer shoot out your nose.

    VB5 Enterprise SP3

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    25

    Question here maybe the code will help you understand my problem

    Code:
    DBGrid1.Columns(2) = DBGrid1.Columns(5) - DBGrid1.Columns(3)
    records.MoveNext
    I just want the answer to actually be visible in columns(2)

    can someone help me please?

    thanks
    If you reach total enlightenment while drinking a beer, I bet it makes beer shoot out your nose.

    VB5 Enterprise SP3

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2000
    Posts
    25

    Exclamation all these smart individuals.....

    can anyone please hlep with this problem?
    If you reach total enlightenment while drinking a beer, I bet it makes beer shoot out your nose.

    VB5 Enterprise SP3

  4. #4
    Lively Member
    Join Date
    Aug 2000
    Posts
    125
    I did this where col 3 = col 1 + col 2
    while numbers are being entered


    Code:
    Private Sub DBGrid1_AfterColEdit(ByVal ColIndex As Integer)
        Dim s!
        
        With DBGrid1
            .Col = 0
            s = Val(.Text)
            .Col = 1
            s = s + Val(.Text)
            .Col = 2
            .Text = Str$(s)
     
            Select Case ColIndex
                Case 0: .Col = 1
                Case 1: .Col = 0
            End Select
        End With
    End Sub

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