dmdougla Posted May 1, 2004 Posted May 1, 2004 Here is some of my code and I am really lost . Public Structure sPayroll Public empNum2 As Integer Public pDate As String Public gross As Double Public wHolding As Double Public FICA As Double Public net As Double End Structure I want to read data from a Payroll.txt file into this structure. How do I do this. Quote
*Experts* mutant Posted May 1, 2004 *Experts* Posted May 1, 2004 Depends on how your file is structured. Mind giving an example? Quote
Denaes Posted May 1, 2004 Posted May 1, 2004 Here is some of my code and I am really lost . Public Structure sPayroll Public empNum2 As Integer Public pDate As String Public gross As Double Public wHolding As Double Public FICA As Double Public net As Double End Structure I want to read data from a Payroll.txt file into this structure. How do I do this. The data would have to be on one line each per item (to do it easily). Dim payroll As sPayroll Do While Reader.ReadLine = "***" With payroll .empNum2 = Reader.ReadLine .FICA = Reader.ReadLine .gross = Reader.ReadLine .net = Reader.ReadLine .pDate = Reader.ReadLine .wHolding = Reader.ReadLine End With Loop This is set up for a seperater being: ***. Anything else will stop reading. So the text file has to be formated: Seperator EmployeeNumber FICA Gross NET Date witholding Seperator etc You may have to create funtions to validate the data. You wouldn't want to kill your app by throwing someones name into their gross pay or ID number. Honestly I hope this is just a project. I don't think a textfile is the safest place to hold tax information for employees. I'd at least go with a database that was password protected. In the least I'd write/read to/from a text file in some sort of encrypted form like creating a function to scramble/unscramble the characters in the string. Quote
Denaes Posted May 3, 2004 Posted May 3, 2004 Thanks you saved me a lot of time. Try to do as much as you can, then ask as specific questions as you can. Honestly I did this because I read the post, then realized I needed to create a setting file for my app. So I did this for my app to hold settings. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.