StringGrid for .NET

Started by
5 comments, last by Night Elf 19 years, 11 months ago
I''m starting to use the .NET framework because I think it''s useful to make some editors for my game. I was used to using Borland C++ Builder, where I had a lot of controls to chose from to make my user interfaces with. I find the default set of controls in .NET (Windows Forms) rather lacking... What I''m in need now is a control similar to TStringGrid from Borland VCL. Does anyone know where I can find something like this? Also, is there any place that offers [freeware] Windows Forms controls to download? Thanks for your help. Mariano Ruggiero Lead Programmer ONIRIC GAMES
Advertisement
How about a ListView with View set to Detail? You''ll have to remember to add the right number of elements to the Column collection for things to show up properly, but it should work pretty similarly to a TStringGrid.
Close... but it''s not the same. I''d like to be able to directly enter data into the grid and the ListView doesn''t appear to be handy for this. You have to enable the LabelEdit property to be able to enter data, but you have to click and wait (or press F2) for each item you want to add...

What I''m actually looking for is something like a DataGrid, but without having to bind it to a database. I just want to be able to enter data in the grid and the read it back so I can store it in my own custom format.
Then you have three options:

1) Search the net for an applicable control.
2) Use something different, as mention by SiCrane

or

3) Stick with using Borland C++ Builder.

I am a believer of using the right tool for the right job. IMO, there is no point in trying to emulate what Borland C++ Builder did for you using the .NET Framework. You''ll be able to find a similar solution, one that may even be better.

I also believe in using the right tool for the job. That''s why I''m trying to use .NET. I''m coding all my engine in unmanaged C++ and I thought using managed C++ (with the help Windows Forms designer, available now in VS.NET 2003) was excellent for two reasons:

- I''m using some MS-specific code in my engine, so I would have to correct some parts to make them compile with Borland C++ Builder.

- BCB is not totally compatible with DirectX, which is what I''m using as a graphics API.

I''ve tried using BCB for my editors in the past, but I found it almos impossible to make my engine work from BCB (at least without some major code rework).

quote:1) Search the net for an applicable control.


I am doing so. But I''ve had no luck so far...

quote:2) Use something different, as mention by SiCrane


Using the ListView as suggested is not practical. I could use a DataGrid and bind it to some ''fake'' database, but that would be a horrible hack.

Mariano Ruggiero
Lead Programmer
ONIRIC GAMES
You can bind the datagrid to an in-memory table (DataTable). We do this all the time in our Winform apps to give people a database-feeling input display for a non-database backend.

Here''s some VB.NET code (it translates 1:1 to C#...unfortunately my managed C++ skills are lacking):

Dim table As New DataTableDim key as String = "TestKey"Dim value as String = "TestValue"table.Columns.Add("Key")table.Columns.Add("Value")table.Rows.Add((New Object() {key, value}))Me.DataGrid1.DataSource = table


Hope this helps.

Epolevne
That seems like a pretty neat solution. Not as ready-to-use as I''d like (like Borldand''s) but I think it''s OK. Thank you very much, Epolevne!

Mariano Ruggiero
Lead Programmer
ONIRIC GAMES

This topic is closed to new replies.

Advertisement