Hallo Dieter,
ich habe eine banale Frage zur Anzeige des DataGrids. Ich erstelle ein Testprogramm füe die Dsiposition von Omnibussen und stütze mich dabei auf Dein Beispiel List-Mode zu Datagrid 3. Ich rufe InitGrid auf und erwarte dann die Anzeige des Grids mit den generierten Columns. Testhalber sind das fix 6. Das Grid ist aber weiterhin leer. Was mache ich hier falsch, kannst Du mir auf die Sprünge helfen?
Danke
Rainer
Private Sub InitGrid()
With sevGrid1
.RowHeight = 50
.LockUpdate True
.DataMode = Mode_List
.Clear True
.ColumnHeaderHeight = 30
.CellSpacingH = 1
.CellSpacingV = 2
.GridLines = GRID_BOTH
.GridLinesShowAlways = True
.AllowColumnClick = False
.ScrollBars = SB_AUTO
.AutoNumberFixedCol = True
' ---------------------------------------------------------------------
' -------
' Feststehende Spalten definieren
' ---------------------------------------------------------------------
' -------
.FixedColCount = 4
.FixedCol = True
With .FixedColumns(2)
.Caption = "Bus"
.Align = ALIGNMENT_LEFT
.HeadAlign = ALIGNMENT_LEFT
.Width = 1300
.RowBackColor = sevGrid1.BackColor
End With
With .FixedColumns(3)
.Caption = "Bezeichnung"
.Align = ALIGNMENT_LEFT
.HeadAlign = ALIGNMENT_LEFT
.Width = 2000
.RowBackColor = sevGrid1.BackColor
End With
With .FixedColumns(4)
.Caption = "Sitze"
.Align = ALIGNMENT_CENTER
.HeadAlign = ALIGNMENT_CENTER
.Width = 750
.RowBackColor = sevGrid1.BackColor
End With
' ---------------------------------------------------------------------
' -------
' columns und Titel generieren (für Test 6 Spalten)
' ---------------------------------------------------------------------
' -------
m_Days = 6
ColWidth = 3000
For i = 1 To m_Days
vDate = DateAdd("d", i - 1, m_DateFrom)
With .ColumnAdd(Format$(vDate, "yymmdd"), Format$(vDate, "Ddd") & _
vbCrLf & Format$(vDate, "dd.mm"), ColWidth, , , , ALIGNMENT_CENTER)
bHeute = (Format$(vDate, "yyyymmdd") = Format$(Now, "yyyymmdd"))
If bHeute Then
.Caption = "Heute" & vbCrLf & Format$(vDate, "dd.mm")
End If
.Bold = bHeute
If Weekday(vDate) = vbSunday Then .ForeColor = vbRed
End With
Next i
.AutoSort = True
.AllowMultiSelect = True
.AllowEdit = True
.AllowDelete = True
.AllowColumnReorder = True
.LockUpdate False
.Refresh
End With
End Sub |