Using DataGridView with Hashtables

G

Guest

Hello everybody!

I'm using C# to program a library management tool and am done with the
storage of the data in an xml-structure. The data are read at startup and
managed in a hash table for fast searching, since the amount of book-objects
goes into the 10k's.

I'm working around the display of the data with a DataGridView. Could
someone explain to me, how to transfer the data into the structure, since i
can use an object as a data source. I tried creating a table class, using a
struct row containing the fields and instantiate new rows by using a "query"
on the hashtables. But now i have no idea, how to display these rows in the
grid.

Any help would be MUCH appreciated ...

Robert
 
G

Guest

Thank you Tasos for your quick reply!

The links surely were useful, now i have a DataTable holding the book
details, for testing i started with just 1 field Title.
And the DataTable is assigned as DataBinding at the form_load to a DataGrid.
But the DataGrid doesn't show the records i inserted, resetBindings and
refresh doesn't help here. Which important feature am i missing out?

btw, considering the amount of data used, would you recommend searching in a
hashTable, accessing the objects directly and writing the changes back to the
dataTable or do it on the table itself?
bc quick filtering options like "show all books from this author", "find
similar titles" etc are required, along with normal search for title, isbn
etc...

Thank you
Robert
 
G

Guest

You should have a bindingsource which is the datasource of the grid and has a
datasource of your datatable.
you can uise the Filter properties of the datatable to run searchs like sql
where clauses or get a grid like the infragistics grid which has filtering
and searching built in and very good and flexible

Ciaran O'Donnell
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top