SUB DoFillAfterLoad
for xx = 1 to linecount 'rows
for yy = 1 to len(CelticLine[xx])'columns
'IWG_DeleteCell(main,502,xx,yy)
'IWG_InitCellDat(main,502, xx, yy," ")
IWG_SetCellDat(main,502, xx, yy,MID$(CelticLine[xx], yy, 1))
next yy
next xx
ENDSUB
Larry,
executing the above code even with the rem'd lines unrem'd doesn't fill the grid starting at row1,column1 but appends the second file behind the first.
What's wrong?
Thanks,
Richard
I need to see how /what you load into the CelticLine[xx] array.
This is my Load code
SUB DoLoad
for rr = 1 to IWG_GetRows(main, 502)
CelticLine[rr] =""
next rr
linecount = 0
filename = filerequest("Load File",main,1)
IF(OPENFILE(CelticFile,filename,"R") = 0)
'--------------------------------------------------------
Do :
IF(READ(CelticFile,ln[x]) = 0)
linenum = linenum+1
CelticLine[linenum]=ln[x]
ENDIF
Until EOF(CelticFile)
linecount = linenum
'--------------------------------------------------------
CLOSEFILE CelticFile
'PRINT "File read successfully!"
ELSE
'PRINT "File not found!"
ENDIF
Richard
I'm not seeing what the problem.
Hate to be a bother but can you rig me up a test program with just thee code you have shown me and the file you are reading so I can do some testing.
Email it to me if you like.
Larry
Larry,
I'm using an array in my code and didn't care for the index is zero based .
Sorry for the hazzle!
Richard
this is the only places I made changes and it works fine:
SUB DoLoad
for rr = 1 to IWG_GetRows(main, 502)
CelticLine[rr] =""
next rr
linecount = 0
filename = filerequest("Load File",main,1)
linenum = 0 '<===========this missing caused the addon @ row 13
IF(OPENFILE(CelticFile,filename,"R") = 0)
'--------------------------------------------------------
Do :
IF(READ(CelticFile,ln[x]) = 0)
'count lines
linenum = linenum+1
'store line in new array element
CelticLine[linenum]=ln[x]
ENDIF
Until EOF(CelticFile)
linecount = linenum
'--------------------------------------------------------
CLOSEFILE CelticFile
'PRINT "File read successfully!"
ELSE
'PRINT "File not found!"
ENDIF
RETURN
ENDSUB
SUB DoFillAfterLoad
'<====== and I cleaned this up to just what you need==================
IWG_DeleteAllCells(main, 502)
for xx = 1 to linecount 'rows
for yy = 1 to len(CelticLine[xx])'columns
IWG_InitCellDat(main,502, xx, yy," ")
IWG_SetCellDat(main,502, xx, yy,MID$(CelticLine[xx], yy, 1))
next yy
next xx
ENDSUB
it doesn't matter if you start at 0 or 1 as long as your array is define big enough and you are consistent where you start