View Full Version : Grid Help Needed
Jerryab
03-09-2010, 03:27 PM
Is there a way to save the GRID without saving the top row (0).
Trying to save a grid but don't want the top row saved.
Using the:
bSave = Grid.SaveToFile("Grid1", "AutoPlay\\Docs\\Text.cvs", ",");
does not give any control on what is saved.
Any Suggestions ?
Thanks..
RizlaUK
03-10-2010, 04:13 AM
loop through the grid items, save each row as a line of text
something like this should work (UNTESTED CODE)
function SaveGridRowsToFile(sGrid, sFile)
local nRowCount = Grid.GetRowCount(sGrid);
local nColCount = Grid.GetColumnCount(sGrid)
if nRowCount > 0 and nColCount > 0 then
for nRow=1, nRowCount do
local sRowText=""
for nCol=0, nColCount do
local sItem = Grid.GetCellText(sGrid, nRow, nCol)
sRowText=sRowText..sItem
end
TextFile.WriteFromString(sFile, sRowText, true);
end
end
end
SaveGridRowsToFile("Grid1", "C:\\MyFile.txt")
but i havent got time to test it
jassing
03-10-2010, 09:58 AM
You, of course, will want to change
sRowText=sRowText..sItem
to format it -- such as;
sRowText=sRowText..", "..sItem
RizlaUK
03-10-2010, 02:37 PM
yup, i did say it was untested!
jassing
03-10-2010, 02:49 PM
The nice thing about aircode is it's fun to find out your code was perfect -- an air-code review (I didn't compile it) says it look good -- just that one bit. I'm always impressed when I get aircode 100% (which isn't as often as my ego thinks it is)
RizlaUK
03-10-2010, 03:07 PM
get aircode 100%, i test code and its still not 100%, to eager to post sometimes and miss the obvious....how could i forget the d.a.m delimiter
the "UNTESTED CODE" is just insurance against "IT DON'T WORK", and anyway......the OP learns something trying to fix my code, lol
which isn't as often as my ego thinks it is
lol, yea, me too, if i was as good as my ego thinks i am id be working at MicroShaft by now!
Jerryab
03-11-2010, 01:17 AM
About Grid Example. I am a newbie and had a bit of a problem with the Grid.
I did not find much help for it either in the forums. So I found the example
called TextFile2Grid and expaned on it a little.
Also I would like to thank RizlaUK for the help he gave me on saving the grid
without row Zero. It did not work the best but sure lead me in the right
direction and I was able to fix it. So because of not much about the Grid for
examples I wrote this.
I Hope this little program is a help to others.
Anyone can use this as they see fit.
JerryAB
See Attached ****
RizlaUK
03-11-2010, 06:33 AM
Hey, for a newbie that's a pretty good example, you should also post it in the examples forum so other users can find it with ease
Well Done and keep up the good work :yes
Jerryab
03-11-2010, 07:03 AM
I did as you suggested and sent it to the examples forum. I guess it has to be checked out before it gets posted.
Anyway thank you for the compliment. I know I need alot more pratice
cause I really hate to do documentation and still need to get down the
proper way to code. All in time I guess. I figured it was good enough
for others to get something out of it anyway.
JerryAB
RizlaUK
03-11-2010, 08:04 AM
i like to see someone at least try, there are some users that have been asking stupid questions for the last 4 years....they learn nothing, its nice when people show a willingness to learn
in 2 years you will look at the code you write now and think "man, iv learned so much", i know i did, and still learning
Sakuya
03-11-2010, 08:18 AM
in 2 years you will look at the code you write now and think "man, iv learned so much", i know i did, and still learning
That is too true.
Jerryab
03-11-2010, 11:54 AM
Well here I go again. The more I looked at my little app the more something
did not look right. Well here is a new update Grid Examples v1.01.
I added a button to save data to a chosen record.
Now that is all I'm going to do to this Example as I think it says alot about
it's self and some usefull code for beginers.
I say done UnLess..... bla, bla, bla
I'm sure all you have been there done that...
Thanks ALL again for the help.
For the newbies......... Have Fun.........
JerryAB
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.