Visual Basic code

Discussion in 'OT Technology' started by AriS, Feb 16, 2008.

  1. AriS

    AriS New Member

    Joined:
    Jan 29, 2004
    Messages:
    391
    Likes Received:
    0
    Can anyone help me and tell me what each of the line does in Visual Basic? :hs:

    Dim sr As IO.StreamReader = IO.File.OpenText("PAYROLL.TXT")
    Dim name As String
    Dim hourlyWage, hoursWorked, salary As Double
    'The text file is placed in the Debug subfolder
    'of the bin subfolder of the folder 3-5-3.
    name = sr.ReadLine
    hourlyWage = CDbl(sr.ReadLine)
    hoursWorked = CDbl(sr.ReadLine)
    salary = hourlyWage * hoursWorked
    lstPayroll.Items.Add(name & " " & FormatCurrency(salary))
    name = sr.ReadLine
    hourlyWage = CDbl(sr.ReadLine)
    hoursWorked = CDbl(sr.ReadLine)
    sr.Close()
    salary = hourlyWage * hoursWorked
    lstPayroll.Items.Add(name & " " & FormatCurrency(salary))
     
  2. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    Reads 6 lines from a text file figures out the salary based on hours worked and wage places each person it reads into a list box
     
  3. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    1. The guy who wrote it should be smacked for not providing comments.

    2. I'm not going to do your homework.
     
  4. AriS

    AriS New Member

    Joined:
    Jan 29, 2004
    Messages:
    391
    Likes Received:
    0
    y not? :wtc: fucking programming
     
  5. P07r0457

    P07r0457 New Member

    Joined:
    Sep 20, 2004
    Messages:
    28,491
    Likes Received:
    0
    Location:
    Southern Oregon
    looks like a 100-level programming class. If you can't figure this out, then this is not the correct career path for you.
     
  6. AriS

    AriS New Member

    Joined:
    Jan 29, 2004
    Messages:
    391
    Likes Received:
    0
    This is my only programming class. I knew programming wasn't for me when I took that one java class in HS...
     
  7. drjamima

    drjamima Active Member

    Joined:
    Nov 5, 2005
    Messages:
    54,004
    Likes Received:
    0
    Location:
    Portland
    .
     
  8. AriS

    AriS New Member

    Joined:
    Jan 29, 2004
    Messages:
    391
    Likes Received:
    0
    Ok, I read through the book and comprehend most of it, but what does the sr.Readline mean?

    like the sr. text. like sr.Close, sr.Readline
     
  9. BlackWRX

    BlackWRX New Member

    Joined:
    Apr 25, 2002
    Messages:
    25,574
    Likes Received:
    0
    Location:
    Bay Area, CA
    streamreader object
     
  10. deusexaethera

    deusexaethera OT Supporter

    Joined:
    Jan 27, 2005
    Messages:
    19,712
    Likes Received:
    0
    It reads a line of text.
     

Share This Page