![]() |
| ||
| reading and saving data to textfiles... So school's out for a month and Ive been doing some hobby VB6 programming... Im writing calculators involving up to 25 variables, many constants, etc, etc, etc.. So, instead of requiring the user to input all the vars I thought I'd allow the loading of comma- or tab-delineated textfiles with appropriate values already there for particular cases. For instance, to calculate the concentration of an organic acid in equilibrium with X other species in solution of X unknowns at, say, standard temp and pressure; all the user would have to do is load that file and input one or two values. Additionally, I would like to allow for saiving the file if the user wanted to change the inputs for compund- or solution-specific, non-ideal conditions... So can you all recommend a simple tutorial that will discuss the process of how to load/save the files? TIA!:) -gkd |
| ||
| Re: reading and saving data to textfiles... Dont know about VB but for PB for windows it should be easy open filename$ for binary as #1 get$ #1,lof(1),info$ numberoffields&=parsecount(info$) dim myarray$(numberoffields&) for k&=1 to numberoffields&:myarray$(k&)=parse$(info$,k&):next:close #1 something like that (default of parse is comma delimiter) |
| ||
| Re: reading and saving data to textfiles... Hi Before you ask for any help in VB Check this first always http://msdn.microsoft.com/ and search there I have always found that this site gives answers to most microsoft related queries If you dont find what you need PM me i will send across a sample as to how to save to text files yni420 |
| ||
| Re: reading and saving data to textfiles... Er...um. :o Sorry for the stupid thread. I developed a realy cool solution to my problem that reads each value from a CSV by splitting the string and then appends the file onthefly ('kind of') to a temp file, for which a new CSV line is written everytime the program goes through 10 iterations of the calculation, then at the end of the routine reads the final values (last lin) from the temp file which are written into the the app and then optionally saved into original file and stored as the resultant theoretical solution properties. Im working on a method to compare this to lab measured values now. thanks for all your help. |
| All times are GMT -4. The time now is 4:16 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC