This is the program im trying to write:

http://farm3.static.flickr.com/2324/2003724328_63220be6bf.jpg?v=0

I have this so far for coding, and its not working. I also get this error "Conversion from string "h" to type 'Boolean' is not valid"

Dim totalstandardhalfday As Double
Dim totalstandardardfullday As Double
Dim totaldeluxehalfday As Double
Dim totaldeluxefullday As Double
totalstandardhalfday = 30 + 32
totalstandardardfullday = 65 + 30
totaldeluxehalfday = 72 + 30
totaldeluxefullday = 144 + 30
If txtitem.Text = "1" & txtduration.Text = "h" Then
lstreceipt.Items.Add("Receipt from Victor's Room Rental")
lstreceipt.Items.Add(" ")
lstreceipt.Items.Add("Standard Rooming" & " $32.00" & " Half-day Rental")
lstreceipt.Items.Add("Deposit" & " $30.00")
lstreceipt.Items.Add("")
lstreceipt.Items.Add("Total:" & " " & FormatCurrency(totalstandardhalfday))
Else : txtitem.Text = "1" & txtduration.Text = "F"
lstreceipt.Items.Add("Receipt from Victor's Room Rental")
lstreceipt.Items.Add(" ")
lstreceipt.Items.Add("Deluxe Rooming" & " $65.00" & " Full-Day Rental")
lstreceipt.Items.Add("Deposit" & " $30.00")
lstreceipt.Items.Add("")
lstreceipt.Items.Add("Total:" & " " & FormatCurrency(totalstandardardfullday))
End If
If txtduration.Text = "2" & txtitem.Text = "H" Then
lstreceipt.Items.Add("Total:" & " " & FormatCurrency(totaldeluxehalfday))
Else : txtduration.Text = "2" & txtitem.Text = "F"
lstreceipt.Items.Add("Total:" & " " & FormatCurrency(totaldeluxefullday))
End If


Thanks In Advance.

In your If statment

If txtitem.Text = "1" & txtduration.Text = "h" Then

You need to use the word AND not &

If txtitem.Text = "1" AND txtduration.Text = "h" Then

Ahhhh it works perfect Thanks, but now its Doing 2 calculations. how can i fix this?

It is your Ifs

If * Then
  'Do This
Else
  'Or Do This
End If
                              'AND
If *2 Then
  'Do This
Else
  'Or Do This
End If

Fires off the code for one of the Ifs and One Else

Try

If * Then
  'Do This
ElseIf *2 then
  'Or Do This
ElseIf *2 Then
  'Or Do This
Else
  'Or Do This
End If
commented: Helpful, understood what i wanted to get out of my program +1

Nice. Thanks. Yeah i knew it was something wrong with the ifs, but i didn't know which way to put them. Really Helpful Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.