Sodele, hab die Lösung auf mein Problem gefunden... wenn es euch Interessiert hier die Objekte die ich gefunden habe...
http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/S_Grid_2/article.asp <-- ist KOSTENLOS
und noch die zwei, wobei diese nicht kostenlos sind...
http://www.objectdcl.com/ObjectDCL.html
http://www.grid2000.com/
Ich habe mich für die etwas schwierigere Kostenlose methode entschieden...
Hier mal der Code...
Dim Auswahl(2) As String
Private Sub Form_Load()
Auswahl(0) = "Vorname"
Auswahl(1) = "Nachname"
Auswahl(2) = "Nicht relevant"
stellmichein vbalGrid1, 5, 500
End Sub
Private Sub stellmichein(Grid As vbAcceleratorSGrid6.vbalGrid, Anzahl As _
Integer, Breite As Long)
Dim i As Integer
With Grid
.Clear True
.Redraw = False
.StretchLastColumnToFit = True
.GridLineColor = &HC0C0C0
.GridLines = True
.Editable = True
.DefaultRowHeight = Combo1.Height \ Screen.TwipsPerPixelY
For i = 1 To (Anzahl)
.AddColumn "ID" & i, , , , (Breite / Anzahl)
Next i
.AddRow
For i = 1 To (Anzahl)
.CellDetails 1, i, "Bitte wählen", DT_WORD_ELLIPSIS Or _
DT_SINGLELINE, , , , , 0
Next i
.Redraw = True
End With
End Sub
Private Sub Combo1_Click()
Dim lRow As Long
Dim lCol As Long
If (Combo1.ListIndex > -1) Then
With vbalGrid1
If (.InEditMode) Then
lRow = .EditRow
lCol = .EditCol
.EndEdit
.CellText(lRow, lCol) = Combo1.List(Combo1.ListIndex)
Combo1.Visible = False
End If
End With
End If
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If (KeyCode = vbKeyEscape) Then
vbalGrid1.CancelEdit
Combo1.Visible = False
End If
End Sub
Private Sub vbalGrid1_CancelEdit()
Combo1.Visible = False
End Sub
Private Sub vbalGrid1_RequestEdit(ByVal lRow As Long, ByVal lCol As Long, ByVal _
iKeyAscii As Integer, bCancel As Boolean)
Dim lLeft As Long, lTop As Long, lWidth As Long, lHeight As Long, i As _
Integer
vbalGrid1.CellBoundary lRow, lCol, lLeft, lTop, lWidth, lHeight
With Combo1
.Clear
.Move lLeft + vbalGrid1.Left, lTop + vbalGrid1.Top + _
Screen.TwipsPerPixelY, lWidth
For i = 0 To UBound(Auswahl)
.AddItem Auswahl(i)
If vbalGrid1.CellText(lRow, lCol) = Auswahl(i) Then
.ListIndex = i
End If
Next i
.Visible = True
'.ZOrder
.SetFocus
End With
End Sub Gruß,
Thomas |