DataGrid Help

There a many posts about DataGrid and I have been searching and reading for days and have made some progress with my program. There are a couple of things I want to do that I can't work out.

When I enter a new row of data into my datagrid I want to jump from the current column to the next column when I click the enter key. I have tried a simple "DataGrid1.Row = DataGrid1.Row + 1" which does move the cursor to the next cell but for some reason it leaves the previous columns input in the cell and takes the newly input value to the next cell. There must be a simple way of doing this?

When the datagrid is first filled with data from my database I also want to show another row across the bottom which will show totals of each column value. They all have numeric values in them. Is this possible?

I also want to add another column that is not part of the database table that will show a value by taking the database values in the same row and applying a formula. Is this possible?

Hope I have explained myself OK and any help will be greatly appreciated.
[1099 byte] By [Taipan] at [2007-11-19 14:00:02]
# 1 Re: DataGrid Help
In your case I would prefer to use MS FlexGrid. In that you can change selection, and easily addinc Rows, cols and filling them with calculated values.

Jonny Poet :wave:
JonnyPoet at 2007-11-9 20:29:03 >
# 2 Re: DataGrid Help
Thanks for your suggestion Jonny Poet. I was wondering this. But the MS FlexGrid does not update the database does it?Can I edit the data in it and reload the data back into the database from a MS FlexGrid?
Taipan at 2007-11-9 20:30:08 >
# 3 Re: DataGrid Help
I couldn't work out how to fill the MS FlexGrid with the data from my database but I've made some progress using a MSHFlexGrid. I can fill it with the data from my database and have found how to edit the cells using a textbox. Just have to work out how to update the database etc etc. Is a MSHFlexGrid similar to the MS FlexGrid in being able to add rows, cols and fill them with calculated values?
Taipan at 2007-11-9 20:31:07 >
# 4 Re: DataGrid Help
... Is a MSHFlexGrid similar to the MS FlexGrid in being able to add rows, cols and fill them with calculated values?If you can work with an MSH Flexgrid then you can also do a MS Flexgrid. But its also OK to use anMSH Flexgrid, for its very similar to each other. In Datagrids fields are conneted to a database so you easily run in problems when you need to do summation. I had just done a very nice example how to use a MS Flexgrid and how to input data by hand and a calculation. It has no database connection but that will be the easiest thing i think. You will find it this thread http://www.dev-archive.com/forum/showthread.php?p=1239063#post1239063 Look at Post #14 'Bendingmoment2Ver.zip'
It shows how to put an textbox on top of the MS Flexgrid so you directly can type in values and in Col three it calculates the bendingmoment of Col1 and Col2 I hope this will help a bit showing about calculation of Values out of a MS Flexgrid

Jonny Poet :wave:
JonnyPoet at 2007-11-9 20:32:06 >
# 5 Re: DataGrid Help
Hi Jonny,
Thanks for the tips and example. It definitely shows me a lot about using the FlexGrid. Much appreciated.
Taipan at 2007-11-9 20:33:05 >
# 6 Re: DataGrid Help
Hi Jonny,
Thanks for the tips and example. It definitely shows me a lot about using the FlexGrid. Much appreciated.If you get in trouble loading data to the MS Flex tell me. I think I have an example anywhere with MS Access

Jonny Poet :wave: :wave:
JonnyPoet at 2007-11-9 20:34:04 >
# 7 Re: DataGrid Help
If you get in trouble loading data to the MS Flex tell me. I think I have an example anywhere with MS Access

Jonny Poet :wave: :wave:

Sorry to be a pain, but I would like to see your example on loading data into the MSFlexGrid, if you wouldn't mind. Thanks.
Taipan at 2007-11-9 20:35:13 >
# 8 Re: DataGrid Help
also u can see following link
http://www.dev-archive.com/forum/printthread.php?t=25922
query4u at 2007-11-9 20:36:16 >
# 9 Re: DataGrid Help
Sorry to be a pain, but I would like to see your example on loading data into the MSFlexGrid, if you wouldn't mind. Thanks.zip your project and post it here and I'll have a look on it and adapt an example into it exactly to your needs. I think thats easiest way, you get it.

Jonny Poet :wave:
If you dont want to post it then you also can email your project to me.
JonnyPoet at 2007-11-9 20:37:14 >
# 10 Re: DataGrid Help
My project at the moment is a total mess, full of lots of different codes that I am testing and working out what will be best for the final project. I have zipped up a very small project which has a MSHFlexGrid that is loading data from a database. There is also a MSFlexGrid which does nothing at the moment. Basically what I want to do at this point is load the MSFlexGrid with the data from the database, but I don't want to show the ID field. I also want a row across the bottom showing the column totals. And if you can show me how to format the data to show with the $ and 2 decimal places I would appreciate it. Thanks for your time on this.
Taipan at 2007-11-9 20:38:09 >
# 11 Re: DataGrid Help
I have done as you wanted some small :lol: :lol: corrections and a little bit of added code ;)

I hope you enjoy.


Jonny Poet
JonnyPoet at 2007-11-9 20:39:18 >
# 12 Re: DataGrid Help
I can't thank you enough JonnyPoet, that is an incredible help. I have a long way to go with this project, but that certainly gets the flexgrid doing what I want. :D
Taipan at 2007-11-9 20:40:10 >
# 13 Re: DataGrid Help
I can't thank you enough JonnyPoet, that is an incredible help. I have a long way to go with this project, but that certainly gets the flexgrid doing what I want. :DYou are welcome :)

Jonny Poet :wave:
JonnyPoet at 2007-11-9 20:41:17 >