- Joined
- Mar 20, 2005
- Location
- Springfield, Missouri
Ok I might just be retarded but for some reason whenever I try to do a function in VB it never returns the value that I tell it to. So I'm probably missing something very obvious but I don't know what it is so any and all help would be nice here's the code. BTW I'm using VB.net 2005:
Sub Research()
Dim sr As IO.StreamReader = IO.File.OpenText("Research.txt")
Dim wage, hour, gross, ded, net, totgross, totded, totnet As Double
Dim name As String
Do While sr.Peek <> -1
name = CStr(sr.ReadLine)
hour = CDbl(sr.ReadLine)
wage = CDbl(sr.ReadLine)
Call Grosspay(hour, wage, gross)
Call Deduction(gross, ded)
Call Netpay(gross, ded, net)
totalnetpay(totnet, net
Function totalnetpay(ByVal totalnet As Double, ByVal net As Double) As Double
totalnet = totalnet + net
Return totalnet
End Function
Grosspay, Deduction and Netpay are all sub procedures that i used ByRef on instead and it returns all the values that it is supposed to correctly except for the totalnetpay. Thank you to anyone that helps.
Sub Research()
Dim sr As IO.StreamReader = IO.File.OpenText("Research.txt")
Dim wage, hour, gross, ded, net, totgross, totded, totnet As Double
Dim name As String
Do While sr.Peek <> -1
name = CStr(sr.ReadLine)
hour = CDbl(sr.ReadLine)
wage = CDbl(sr.ReadLine)
Call Grosspay(hour, wage, gross)
Call Deduction(gross, ded)
Call Netpay(gross, ded, net)
totalnetpay(totnet, net
Function totalnetpay(ByVal totalnet As Double, ByVal net As Double) As Double
totalnet = totalnet + net
Return totalnet
End Function
Grosspay, Deduction and Netpay are all sub procedures that i used ByRef on instead and it returns all the values that it is supposed to correctly except for the totalnetpay. Thank you to anyone that helps.
Last edited: