• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C#.NET question - how the heck do I display a 2D array in a windows form?

notfred

Lifer
What I want is something that looks kind of like an Excel window. It's basically a table of cells. It's not connected to a database, it doesn't require any schemas, nothing complex.


Just a 2D array laid out in a table. How do I do that?
 
Originally posted by: notfred
there's got to be some way to do this?


There is, but it's probably not as easy as you would like. One approach is to use the DataGrid control which will give you your table that you are looking for. Unfortunately, DG's can't bind to a multi-dimensional array. So you have to build a DataTable from your multidimensional array and then bind that to your DG. There are probably a million other ways to do this depending on what type of control you want but something like the following should work.
 
Originally posted by: UCJefe
Originally posted by: notfred
there's got to be some way to do this?


There is, but it's probably not as easy as you would like. One approach is to use the DataGrid control which will give you your table that you are looking for. Unfortunately, DG's can't bind to a multi-dimensional array. So you have to build a DataTable from your multidimensional array and then bind that to your DG. There are probably a million other ways to do this depending on what type of control you want but something like the following should work.

Thank you. 🙂 That code isn't 100% perfect, but it looks like a good starting point.
 
Back
Top