You all are wonderful! I used Wes's suggestion of
If lstWorkshop.SelectedItem Is Nothing And lstLocation.SelectedItem Is Nothing Then
MessageBox.Show("Select both a workshop and a location")
Return
End If
but changed it to CHill60's
If lstWorkshop.SelectedItem Is Nothing Or lstLocation.SelectedItem Is Nothing Then
MessageBox.Show("Select both a workshop and a location")
Return
End If
And removed the .ToString per Nosey Parker (so glad that you are nosy!) and it alll works now!
If anyone is interested, this is the final code (before I add in extra comments, etc.)
Public Class FormWorkshopSelector
Private Sub btnAddWorkshop_Click(sender As Object, e As EventArgs) Handles btnAddWorkshop.Click
Dim intFee As Integer
Dim intTotal As Integer
Dim intDay As Integer
Dim intStay As Integer
Dim Workshop As String = lstWorkshop.SelectedItem
Dim Location As String = lstLocation.SelectedItem
If lstWorkshop.SelectedItem Is Nothing Or lstLocation.SelectedItem Is Nothing Then
MessageBox.Show("Select both a workshop and a location")
Return
End If
Select Case Workshop
Case CStr("Handling Stress")
intDay = 3
intFee = 595
Case CStr("Time Management")
intDay = 3
intFee = 695
Case CStr("Supervision Skills")
intDay = 3
intFee = 995
Case CStr("Negotiation")
intDay = 5
intFee = 1295
Case CStr("How to Interview")
intDay = 1
intFee = 395
End Select
Select Case Location
Case CStr("Austin")
intStay = intDay * 95
Case CStr("Chicago")
intStay = intDay * 125
Case CStr("Dallas")
intStay = intDay * 110
Case CStr("Orlando")
intStay = intDay * 100
Case CStr("Phoenix")
intStay = intDay * 92
Case CStr("Raleigh")
intStay = intDay * 90
End Select
intTotal = intStay + intFee
lstCost.Items.Add(intTotal.ToString("c"))
End Sub
Private Sub btnCalcTotal_Click(sender As Object, e As EventArgs) Handles btnCalcTotal.Click
Dim dblTotal As Double = 0.0
Dim sum As Double
For x As Integer = 0 To lstCost.Items.Count - 1
sum += CDbl(lstCost.Items(x))
Next
lblTotalCost.Text = sum.ToString("c")
End Sub
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
lstWorkshop.SelectedIndex = -1
lstLocation.SelectedIndex = -1
lstCost.Items.Clear()
lblTotalCost.Text = String.Empty
lstWorkshop.Focus()
End Sub
Private Sub FormWorkshopSelector_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Are you sure you want to exit?", "Confirm",
MessageBoxButtons.YesNo) = DialogResult.Yes Then
e.Cancel = False
Else
e.Cancel = True
End If
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
Again, thank you all so very much, I will use all of your suggestions (checking spelling, no need to add .ToString to a string (duh), how to properly place If..Then statements, to pay more attention to details, etc.) in the future.
Have a wonderful rest of your weekend!