Choice Selection help

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Choice Selection help

 
0
  #1
Nov 13th, 2007
This is the program im trying to write:

http://farm3.static.flickr.com/2324/...0be6bf.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.
Last edited by Magnusz; Nov 13th, 2007 at 1:09 pm.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Choice Selection help

 
0
  #2
Nov 13th, 2007
In your If statment
  1. If txtitem.Text = "1" & txtduration.Text = "h" Then
You need to use the word AND not &
  1. If txtitem.Text = "1" AND txtduration.Text = "h" Then
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: Choice Selection help

 
0
  #3
Nov 13th, 2007
Ahhhh it works perfect Thanks, but now its Doing 2 calculations. how can i fix this?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 169
Reputation: ptaylor965 is an unknown quantity at this point 
Solved Threads: 19
Sponsor
ptaylor965's Avatar
ptaylor965 ptaylor965 is offline Offline
Junior Poster

Re: Choice Selection help

 
1
  #4
Nov 14th, 2007
It is your Ifs
  1. If * Then
  2. 'Do This
  3. Else
  4. 'Or Do This
  5. End If
  6. 'AND
  7. If *2 Then
  8. 'Do This
  9. Else
  10. 'Or Do This
  11. End If
Fires off the code for one of the Ifs and One Else

Try
  1. If * Then
  2. 'Do This
  3. ElseIf *2 then
  4. 'Or Do This
  5. ElseIf *2 Then
  6. 'Or Do This
  7. Else
  8. 'Or Do This
  9. End If
Peter Taylor
Visual Basic.NET Application Developer

TaylorsNet
http://www.taylorsnet.co.uk
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 13
Reputation: Magnusz is an unknown quantity at this point 
Solved Threads: 0
Magnusz Magnusz is offline Offline
Newbie Poster

Re: Choice Selection help

 
0
  #5
Nov 14th, 2007
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC