CraigLazar
asked on
Populate a DBGrid via a text file
Hi
I need to populate a dbgrid using a text delimitted file. Also the users must be able to edit the grid and therefore edit the text file.
I am copying or recreating a program where my client lost the source code. The previous developer was populating a grid using a text file. But now my client also wants to be able to edit the values in the grid
thanx
:)
Craig
I need to populate a dbgrid using a text delimitted file. Also the users must be able to edit the grid and therefore edit the text file.
I am copying or recreating a program where my client lost the source code. The previous developer was populating a grid using a text file. But now my client also wants to be able to edit the values in the grid
thanx
:)
Craig
How about importing the grid to a db then editting it using a grid, export back to text file.
Just an idea but it is worth trying!
Populate an in-memory ADO recordset and bind it to a DataGrid control. Then place a button that will recreate the delimitted text file from the recordset!
Populate an in-memory ADO recordset and bind it to a DataGrid control. Then place a button that will recreate the delimitted text file from the recordset!
How about using ODBC Text driver best for UR case I believe
inpras
inpras
Look, DBGrid means DataBaseGrid, not TextGrid. you can make your own grid control via text box control arays.
ASKER
Thanx but idecided to use a dbgrid and rather populate it from an access database, now just gotta see if the client is happy with it
thanx for all the input though
:)
Craig
thanx for all the input though
:)
Craig
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As for getting the textfile in, if the delimiters are tabs, then it is simply a matter of reading the file line by line as follows :
F = FreeFile
Open "c:\whereisit.txt" For Input AS #F
While Not F.EOF
Line Input #F,Tmp
Grid1.AddItem Tmp
WEnd
Close #F
To update the text file, you'll need to write the entire file.
To locate axgrid, just search for it on the net. If you can't find it, let me know so that I can upload it to some or other server.
The suggested solution is not ideal (a DBGrid operating on a textfile would be nicer), but if no one answers or your client is breathing down your neck, give it a bash.