# School is over, I never solved this one. Help PLEASE

Page 1 of 1

## 3 Replies - 1158 Views - Last Post: 18 December 2013 - 06:58 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=336775&amp;s=cd7433510c67d052e32fd6f66568deee&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 peper

Reputation: 0
• Posts: 3
• Joined: 13-December 13

# School is over, I never solved this one. Help PLEASE

Posted 18 December 2013 - 01:37 AM

School is over and try as I might I never solved this one and truth be told I just have to know. The user should enter the number of spools ordered into the text box. When the CALCULATE TOTAL button is clicked an input box should appear asking how many spools are currently in stock. If the user enters more spools than are on hand then a back order is created.

```  Dim lblSandD As Object
Dim lblTotalDue As Object
Dim lblShipH As Object
Dim intSpoolsOrdered As Object

Private Property txtSpoolsOrdered As Object

Private Sub btnCalc_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalc.Click
Dim intSpoolsOrdered As Integer ' The number of spools ordered
Dim intSpoolsInStock As Char ' The number of spools in stock
Dim intBackOrder As Integer     ' Holds the spools on back order
Dim intSpoolsTotal As Integer   ' Holds the total cost of spools ordered
Dim decSandH As Decimal      ' Holds the shipping charges
Dim decTotal As Decimal    ' Holds the order total
' Call the GetInStock Function
GetInStock()
' The number of spools the user wants to order

' Calculate the Total Cost of Spools ordered
intSpoolsTotal = intSpoolsOrdered * 100
decTotal = ShippingCharges(intReadyToShip, decSandH) + intSpoolsTotal
intBackOrder = BackOrdered(Val(intSpoolsInStock), intSpoolsOrdered)
lblBackOrder.Text = intBackOrder.ToString()
lblSandH.Text = decSandH.ToString("c")
lblTotal.Text = decTotal.ToString("c")
End Sub
Function GetInStock() As Integer
' This function displays an input box asking the user to
' enter the number of spools in stock. The function returns
' the value entered by the user.
Dim strInput As String          ' Holds the user's input
Dim intSpoolsInStock As Integer ' Holds the number of spools in stock
strInput = InputBox("How many spools are in Stock")
intSpoolsInStock = CInt(strInput)
Return intSpoolsInStock
End Function
Function ReadyToShip(ByVal intSpoolsInStock As Integer, ByVal intSpoolsOrdered As Integer) _
As Integer
' This function accepts the number of spools in stock and
' the number of spools ordered. The function returns the
' number of spools ready to ship.
If intSpoolsOrdered < intSpoolsInStock Then
Else
End If
End Function
Function BackOrdered(ByVal intSpoolsInStock As Integer, ByVal intSpoolsOrdered As Integer) _
As Integer
' This function accepts the number of spools in stock and
' the number of spools ordered. The function returns the
' number of spools on back order. If no spools are on back
' order, return 0.
Dim intBackOrder As Integer     ' Holds the spools on back order
If intSpoolsInStock > intSpoolsOrdered Then
intBackOrder = 0
Else
intBackOrder = intSpoolsInStock - intSpoolsOrdered
End If
Return intBackOrder
End Function
Function ShippingCharges(ByVal intReady As Integer, ByVal decShipping As Decimal) _
As Decimal
' This function accepts the number of spools in ready to ship
' and the per-spool shipping charges. The function returns the
' total shipping and handling charges.
If chkRushD.Checked = True Then
Else
End If
Return decShipping
End Function
Private Sub btnExit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnExit.Click
' End the Application by closing the window.
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnClear.Click
' This procedure resets the controls to default values
ResetSpools()
ResetDelivery()
End Sub
Private Sub ResetSpools()
' This procedure resets the text box and the check box.
txtNumberSpools.Clear()
chkRushD.Checked = False
' Reset the focus to the first fiels
txtNumberSpools.Focus()
End Sub
Private Sub ResetDelivery()
' This procedure clears the labels that display the delivery info.
lblBackOrder.Text = String.Empty
lblSandH.Text = String.Empty
lblTotal.Text = String.Empty
End Sub

Private Sub lblSandH_Click(sender As Object, e As EventArgs) Handles lblSandH.Click

End Sub
End Class
```

Is This A Good Question/Topic? 0

## Replies To: School is over, I never solved this one. Help PLEASE

### #2 andrewsw

• I'm not here to twist your niblets

Reputation: 4451
• Posts: 16,287
• Joined: 12-December 12

## Re: School is over, I never solved this one. Help PLEASE

Posted 18 December 2013 - 04:44 AM

This is VB.NET, not VB6. Topic moved.

VB 2005, 2008, etc., are all versions of VB.NET.

• Home Owner

Reputation: 384
• Posts: 1,960
• Joined: 11-May 12

## Re: School is over, I never solved this one. Help PLEASE

Posted 18 December 2013 - 06:38 AM

Ok, I see your code, but I don't see a question. Is there a specific problem in your program, is it not working how you expected? We need more information.

### #4 CharlieMay

• This space intentionally left blank

Reputation: 1719
• Posts: 5,636
• Joined: 25-September 09

## Re: School is over, I never solved this one. Help PLEASE

Posted 18 December 2013 - 06:58 AM

Can you elaborate on what your actual question is?
We tend to work off of the problems you describe.

Just a quick glance a couple of things stuck out

1. You declare intspoolsintstock as a Char but your remark reads Number of spools in stock.
2. Your function GetInStock states that it returns something but I don't see where you're storing that returned value
Typically when a function returns something required for a calculation or to output to the user it is either called as part of the calculation or its return is assigned to a variable (ie, someVariable = MyFunctionThatReturnsAResult())
3. the next line, after the GetInStock function call then performs a calculation to get a value for intSpoolsTotal but a variable (intSpoolsOrdered) in that calculation was never set to anything after it was declared, which by the way would default to 0 and as you know 0 * anything = 0

Here's what I suggest:
Read through this Debugging Tutorial and then step/work through your code as it process to find out where your issues are. Then when you find something you don't know how to resolve, post back here with a description of your issue and someone will help you resolve it.

This post has been edited by CharlieMay: 18 December 2013 - 06:58 AM