RSS
 

Füllen einer Listbox aus einem Dictionary heraus

Veröffentlicht am Mai 25, 2007 um 12:00 pm

25 Mai

Im folgenden Codebeispiel wird eine Listbox, welche 2 Spalten hat, mit dem Inhalt eines mehrdimensionalen Dictionarys gefüllt.

<span id="more-25"></span>lstTest.DeleteAllRows
Dim intZaehler As Integer
Dim b As Integer
Dim a As Integer
Dim i,y,x As Integer
b = intZaehler // Anzahl der Zeilen des Dictionarys
x = 0
lstTest.columnCount=2
lstTest.columnWidths="66%,34%"
lstTest.AddRow ""
lstTest.Cell(x,0) = "Equitania Weight"
lstTest.CellBold(x,0) = true
lstTest.Cell(x,1) = "Überschrift"
x = x+1
lstTest.AddRow ""
lstTest.CellBorderBottom(x,0)=ListBox.BorderThinSolid //Fügt eine Trennlinie zwischen der Überschrift
lstTest.CellBorderBottom(x,1)=ListBox.BorderThinSolid //und dem 1. Eintrag ein.
x = x+1
lstTest.AddRow ""
x = x+1
do until a &gt; b
    lstTest.AddRow ""
    lstTest.Cell(x,0) = dicTest(a,0)
    lstTest.Cell(x,1) = dicTest(a,7)
    x = x+1
    lstTest.AddRow ""
    x = x+1
    lstTest.AddRow ""
    lstTest.Cell(x,0) = "Beschreibung:"
    lstTest.Cell(x,1) = dicTest(a,1)
    x = x+1
    lstTest.AddRow ""
    lstTest.Cell(x,0) = "Größe:"
    lstTest.Cell(x,1) = dicTest(a,2)
    x = x+1
    lstTest.AddRow ""
    lstTest.Cell(x,0) = "Gewicht"
    lstTest.Cell(x,1) = dicTest(ia,3)
    x = x+1
    lstTest.AddRow ""
    lstTest.CellBorderBottom(x,0) = ListBox.BorderThinSolid //Fügt eine Trennlinie zwischen der Überschrift
    lstTest.CellBorderBottom(x,1) = ListBox.BorderThinSolid//und dem nächsten Eintrag ein.
    x = x+1
    lstTest.AddRow ""
    x = x+1
    a = a+1
  Loop
 

Tags:

Hinterlassen Sie eine Nachricht