Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted
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.

Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...