| | |
Else Statement
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 17
Reputation:
Solved Threads: 0
Well, I did this program and it works, but my instructor wants me to use this statements instead of the one I used:
My original code was:
Instead I have to use:
It works for Package A and Package B, but I am having problems coding PackageC
Thank you
[/CODE]
My original code was:
VB.NET Syntax (Toggle Plain Text)
Dim DiscountVal As Double = 1.0 'ByVal arguments passed as by value (chapter VI) Dim BasePrice As Double = 9.95 Dim AdditionalPrice As Double = 2.0 Dim HoursAllowed As Integer = 10 Dim HoursUsed As Integer = CInt(Me.TextBox1.Text) ' convert to integer Dim HoursOver As Integer = 0 ' Set discount rate for nonprofit. If Me.chkNonProfit.Checked Then DiscountVal = 0.8 ' value is passed End If ' Start branching structure using If..ElseIf If Me.radPackageA.Checked Then BasePrice = 9.95 HoursAllowed = 10 AdditionalPrice = 2.0 ElseIf Me.radPackageB.Checked Then BasePrice = 14.95 HoursAllowed = 20 AdditionalPrice = 1.0 ElseIf Me.radPackage3.Checked Then BasePrice = 19.95 HoursAllowed = Me.TextBox1.Text AdditionalPrice = 0 End If HoursOver = HoursUsed - HoursAllowed If HoursOver < 0 Then HoursOver = 0 End If ' Calculate total. Dim Total As Double = DiscountVal * (BasePrice + (AdditionalPrice * HoursOver)) Me.txtHours.Text = FormatCurrency(Total)
Instead I have to use:
VB.NET Syntax (Toggle Plain Text)
If Me.radPackageA.Checked Then If CInt (Me.Textbox1.Text) < = 10 Then charge = 9.95 else charge = 9.95 +2*(CInt(Me.TextBox1.Text)-10) EndIf
It works for Package A and Package B, but I am having problems coding PackageC
Thank you
[/CODE]
![]() |
Similar Threads
- missing return statement (Java)
- MySQL LIKE statement (MySQL)
- loop in main function to an "if" statement (C++)
- Switch Case Statement (Java)
- run sql statement in asp (ASP)
- switch/case statement (C++)
- change statement (JSP)
- Reading MSWord Document through an ASP Statement (ASP)
Other Threads in the VB.NET Forum
- Previous Thread: Help needed with MP3 Player
- Next Thread: Input Validation...CheckBox and List
Views: 176 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net 2005 2008 access account application arithmetic array arrays basic bing button buttons c# center check checkbox code convert crystalreport data database datagrid datagridview date design designer dissertation dissertations dropdownlist excel fade file-dialog ftp generatetags google gridview hardcopy images inline input insert installer intel internet listview mobile monitor ms net networking objects output passingparameters picturebox picturebox1 port print printing problem project remove save searchbox searchvb.net select serial server shutdown soap sorting studio survey syntax table tcp temperature text textbox time timer toolbox trim update updown user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio2008 web winforms wpf





