Problems with DBGrid in unbound mode and column objects **URGENT**

Problems with DBGrid in unbound mode and column objects **URGENT**

Post by Adriano Trevisa » Sun, 16 Feb 1997 04:00:00



DBGrid control included in VB 4.0 (not the professional version) has many
problems, but there is one that I can't solve.

Using the DBGrid in unbound mode, when adding the first column of a new
record in the grid, I want to look-up a record in a table using the value
entered, then set the second column with the data found in the loaded
record. Altough the help file included in VB 4.0 says that it's possible to
load cell values, I have problems because I get this error:
"Object property or method not found!" or similar. I found that the
property Text of the Column object of a DBGrid control is READ-ONLY. Is it
possible?

 
 
 

1. DBgrid - Unbound Mode Problem - Urgent!!

I don't know if this is the appropriate Newsgroup for this doubt, if isn't
please accept my appolagies.

I have 2 problems with the dbgrid.

First if I have just one record and made the refresh command the dbgrid
appears with many rows blank!? why can I resolve this? I put the code of the
UnboundReadData, to help you to solve this problem:

Private Sub DBGLinhas_UnboundReadData(ByVal RowBuf As MSDBGrid.RowBuffer,
StartLocation As Variant, ByVal ReadPriorRows As Boolean)
  Dim CurRow&, linhas As Integer, Colunas As Integer, LinhassFetched As
Integer, iIncr As Integer

  LinhassFetched = 0
  If ReadPriorRows Then
    iIncr = -1
  Else
    iIncr = 1
  End If

  If IsNull(StartLocation) Then
    If ReadPriorRows Then
      CurRow& = TotalLinhas - 1 'RowBuf.RowCount - 1
    Else
      CurRow& = 0
    End If
  Else
    CurRow& = CLng(StartLocation) + iIncr
  End If

  For linhas = 0 To RowBuf.RowCount - 1
    If CurRow& < 0 Or CurRow& >= TotalLinhas& Then Exit For

    RowBuf.Value(linhas, 0) = Reclinhas(CDbl(CurRow&)).CodArtigo
    RowBuf.Value(linhas, 1) = Reclinhas(CDbl(CurRow&)).Designacao
    RowBuf.Value(linhas, 2) = Reclinhas(CDbl(CurRow&)).Quantidade
    RowBuf.Value(linhas, 3) = Reclinhas(CDbl(CurRow&)).ValorUnitLiq
    RowBuf.Value(linhas, 4) = Reclinhas(CDbl(CurRow&)).Iva
    RowBuf.Value(linhas, 5) = Reclinhas(CDbl(CurRow&)).Desconto1
    RowBuf.Value(linhas, 6) = Reclinhas(CDbl(CurRow&)).Desconto2
    RowBuf.Value(linhas, 7) = Reclinhas(CDbl(CurRow&)).TotalLiq

    RowBuf.Bookmark(linhas) = CStr(CurRow&)
    CurRow& = CurRow& + iIncr
    LinhassFetched = LinhassFetched + 1
  Next linhas
  RowBuf.RowCount = LinhassFetched
End Sub

Second, I'm inserting values in the columns, but if I change to another
control, a button for example, the grid doesn't save the record. Is there
any command that force the dbgrid to do the UnboundWriteData?

Thanks,
Ilidio Pedrosa

2. Help: Update SQL Server Table

3. True DBGrid Pro - Unbound Column in Bound Mode

4. Files CDX

5. Sample code for DBGrid in Unbound mode

6. Where is oledb.lib for HPC platform

7. fill a DBGRID in unbound mode with an array

8. Disconnected Recordset Question

9. fill a DBgrid unbound mode while form loading..

10. dbgrid : unbound mode

11. Need Help in DBGrid using unbound mode

12. Need help with DBGrid in unbound mode

13. Sample code for DBGrid in Unbound mode