DBgrid - Unbound Mode Problem - Urgent!!

DBgrid - Unbound Mode Problem - Urgent!!

Post by ilidi » Wed, 21 Mar 2001 23:40:59

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
    iIncr = 1
  End If

  If IsNull(StartLocation) Then
    If ReadPriorRows Then
      CurRow& = TotalLinhas - 1 'RowBuf.RowCount - 1
      CurRow& = 0
    End If
    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?

Ilidio Pedrosa


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

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

2. TX-Austin-Manufacturing Solutions Architect-BPA SYSTEMS

3. VB4, using DBGrid in unbound mode

4. TX-DALLAS-116450--Software Testing-UNIX-Windows 95-Client/Server-SQL-Consultant

5. How to fill a dbgrid (unbound mode) ?

6. Oracle/Forms Development, Testing, Consultancy, London

7. DBGrid in unbound mode

8. Linking a client with 8.0.3 OCI

9. True DBGrid standard in unbound mode

10. True DBGrid, Standard, Unbound Mode 3

11. Sample code for DBGrid in Unbound mode

12. fill a DBGRID in unbound mode with an array

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