VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "dbgrid"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Private Type grid_info
     uid As Variant
     sw1 As Boolean
End Type

Public RowCnt As Long
Public ColumnCnt As Integer
Public DeleteCnt As Integer

Private daten_tab() As String
Private delete_tab() As Variant
Private info_tab() As grid_info

Public eof As Boolean
Public cargo As Variant


Property Let DatenTab(ByVal cnt As Integer, ByVal col As Byte, ByVal inh As Variant)

    inho = daten_tab(cnt)
    inh1 = ""
    For i = 0 To ColumnCnt - 1
      If col <> i Then
         inh1 = inh1 & Piece(inho, Chr(10), i + 1) & Chr(10)
       Else
         inh1 = inh1 & inh & Chr(10)
      End If
    Next
    daten_tab(cnt) = inh1

End Property


Property Get DatenTab(ByVal cnt As Integer, ByVal col As Byte) As Variant
    DatenTab = Piece(daten_tab(cnt), Chr(10), col + 1)
End Property


Property Get InfoTabUid(ByVal cnt As Integer) As Variant
    InfoTabUid = info_tab(cnt).uid
End Property
Property Get InfoTabSw(ByVal cnt As Integer) As Boolean
    InfoTabSw = info_tab(cnt).sw1
End Property


Property Get DeleteTab(ByVal cnt As Integer) As Variant
    DeleteTab = delete_tab(cnt)
End Property

Public Sub DatenTabAdd(ByVal inh As String, ByVal sw As Boolean, ByVal uid1 As Variant)
    RowCnt = RowCnt + 1
    On Error GoTo add1:
    daten_tab(RowCnt) = inh
add1e:
    On Error GoTo add2:
    info_tab(RowCnt).sw1 = sw
    info_tab(RowCnt).uid = uid1
    On Error GoTo 0
    Exit Sub
add1:
    ReDim Preserve daten_tab(1 To RowCnt + 20)
    ReDim Preserve info_tab(1 To RowCnt + 20)
    daten_tab(RowCnt) = inh
    GoTo add1e:
add2:
    ReDim Preserve info_tab(1 To RowCnt + 20)
    info_tab(RowCnt).sw1 = sw
    info_tab(RowCnt).uid = uid1
    On Error GoTo 0
End Sub

Public Sub DeleteTabAdd(bookmark As Variant)

    uid = info_tab(bookmark).uid
    If uid <> "" Then
        DeleteCnt = DeleteCnt + 1
        On Error GoTo loesch1:
        delete_tab(DeleteCnt) = uid
        On Error GoTo 0
    End If
loesch2:
    For i = bookmark To RowCnt - 1
       daten_tab(i) = daten_tab(i + 1)
       info_tab(i) = info_tab(i + 1)
    Next
    RowCnt = RowCnt - 1
    Exit Sub
    
loesch1:
    ReDim Preserve delete_tab(DeleteCnt + 20)
    delete_tab(DeleteCnt) = uid
    On Error GoTo 0
    GoTo loesch2:
End Sub

Private Sub class_initialize()

   RowCnt = 0
   ColumnCnt = 0
   DeleteCnt = 0
   eof = False
   cargo = ""
   
   Dim daten_tab(1 To 1, 0 To 0)
   Dim info_tab(1 To 1)
   Dim delete_tab(1 To 1)
   
End Sub

Private Sub class_terminate()

cargo = ""

End Sub


Private Function Piece(ByVal s As String, ByVal tr As String, ByVal n As Integer, Optional Default As String) As String
Dim n1 As Byte, i As Integer
Dim r As String, c As String
If IsEmpty(Default) Or IsNull(Default) Or IsMissing(Default) Then Default = ""
    n1 = 1
    r = ""
    For i = 1 To Len(s)
        c = Mid$(s, i, 1)
        If c = tr Then
           n1 = n1 + 1
           If n1 = n + 1 Then Exit For
          Else
           If n = n1 Then r = r & c
        End If
    Next
    If r = "" Then r = Default
    Piece = r
End Function
     
 

