ive attached the example of the program.
i cant get William & Keeper to show up. i select it, then hit caluclate, and it wont show up. Debug says it cant find the file, although i have it in the Debug folder. everything wlse works fine, just William and Keeper. here is the code. and i have to submit this by 12 tonight. it is now....7:47 pm.
Code:
Private Sub btncalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalc.Click
Dim file, customer, status As String
Dim sr As IO.StreamReader
If (cboCustomer.Text = "William & Keeper") Then
file = "org1.txt"
ElseIf (cboCustomer.Text = "Joshemine Company") Then
file = "org2.txt"
ElseIf (cboCustomer.Text = "McColling Foundation") Then
file = "org3.txt"
Else
file = "org1.txt"
MsgBox("No customer selected. Option A will be used.", MsgBoxStyle.Exclamation, "Caution")
End If
sr = IO.File.OpenText(file)
customer = sr.ReadLine
status = sr.ReadLine
sr.Close()
Dim hours As Double
hours = CDbl(txtHours.Text)
Dim total, base, overage As Double
If rad1.Checked Then
base = (9.95)
overage = ((hours - 10) * 2)
total = base + overage
ElseIf rad2.Checked Then
base = (14.95)
overage = (hours - 20)
total = base + overage
ElseIf rad3.Checked Then
base = (19.95)
total = base
End If
If (cboCustomer.Text = "McColling Foundation") Then
total = total - (total * 0.2)
End If
Dim fmtStr As String = "{0,-20}{1,7}{2,7}{3,12}"
lstDisplay.Items.Add(String.Format(fmtStr, "Name", "Hours", "Status", "Bill"))
If (cboCustomer.Text = "William & Keeper") Then
lstDisplay.Items.Add(String.Format(fmtStr, "William & Keeper", hours, status, FormatCurrency(total)))
ElseIf (cboCustomer.Text = "Joshemine Company") Then
lstDisplay.Items.Add(String.Format(fmtStr, "Joshemine Company", hours, status, FormatCurrency(total)))
ElseIf (cboCustomer.Text = "McColling Foundation") Then
lstDisplay.Items.Add(String.Format(fmtStr, "McColling Foundation", hours, status, FormatCurrency(total)))
End If
End Sub
End Class
Bookmarks