Autor Beitrag
Matg40
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 52



BeitragVerfasst: Mo 03.07.06 19:57 
Hi!

Mal wieder ein Problem mit dem DataGridView :roll:


ich möchte eine eigene Datenstruktur (ähnlich eines DataSets) als DataSource für einen DataGridView verwenden.

Mit DataBinding hab ichs hinbekommen, dass ich eindimensionale Strukturen als Liste abbilden kann, aber ich bräuchte eine zweidimensionale Abbildung (Tabelle).


Wie könnte man das hinbekommen :?:

Wie wir eine DataTable dargestellt (als Ansammlung von Zeilen)?


MfG

Matt
Codeexplorer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Fr 05.01.07 09:56 
Schau mal unter "StringGrid unter Winforms" nach. Dort gibt es einen
Delphi-Code-Schnipsel, der Dir weiterhelfen könnte.
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Fr 05.01.07 11:06 
Eine zweidimensionale Struktur ist eine Liste von Objekten. Die Objekte sind die erste, deren Properties die zweite Dimension.
Damit deine Liste bindable ist, muss sie von einer der folgenden Klassen abgeleitet sein:
Zitat:
The DataGridView control supports the standard Windows Forms data binding model, so it will bind to instances of classes described in the following list:

Any class that implements the IList interface, including one-dimensional arrays.

Any class that implements the IListSource interface, such as the DataTable and DataSet classes.

Any class that implements the IBindingList interface, such as the BindingList class.

Any class that implements the IBindingListView interface, such as the BindingSource class.


Wenn du für die zweite Dimension einfach alle öffentlichen Eigenschaften anzeigen willst, musst du nichts weiter dazu tun, ansonsten schau dir einmal ICustomTypeDescriptor oder ITypedList (benutzt DataView) an.
Codeexplorer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 39



BeitragVerfasst: Do 11.01.07 10:54 
Sorry, ich habe die Frage wohl zu flüchtig überlesen. Mein Verweis ist da wohl
keine Hilfe ...