Ask Experts Questions for FREE Help !
Ask
    student107's Avatar
    student107 Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 21, 2012, 08:47 PM
    How do I calculate the number of single rolls of wallpaper needed?
    My code keeps coming out to zero and I am not seeing what I am doing wrong.


    Option Strict On
    Option Explicit On

    Public Class frmWallpaper

    Private Sub CalcRolls(ByVal decArea As Decimal, ByVal decRolls As Decimal, ByVal decRollCoverage As Decimal)

    'Calculate output of single rolls

    decRolls = CDec(decArea / decRollCoverage)

    End Sub


    Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
    'Input Variables
    Dim decLength As Decimal
    Dim decWidth As Decimal
    Dim decHeight As Decimal
    Dim decRollCoverage As Decimal

    'Processing and Output Variables
    Dim decPerimeter As Decimal
    Dim decArea As Decimal
    Dim decRolls As Decimal

    'Validation Variables
    Dim blnIsConvertedLength As Boolean
    Dim blnIsConvertedWidth As Boolean
    Dim blnIsConvertedHeight As Boolean
    Dim blnIsConvertedRollCoverage As Boolean

    'Assign Variables
    blnIsConvertedLength = Decimal.TryParse(txtLength.Text, decLength)
    blnIsConvertedWidth = Decimal.TryParse(txtWidth.Text, decWidth)
    blnIsConvertedHeight = Decimal.TryParse(txtHeight.Text, decHeight)
    blnIsConvertedRollCoverage = Decimal.TryParse(txtRollCoverage.Text, decRollCoverage)

    'Get Single Rolls
    If blnIsConvertedLength And blnIsConvertedWidth And blnIsConvertedHeight And blnIsConvertedRollCoverage = True Then
    If decLength > 0 And decWidth > 0 And decHeight > 0 And decRollCoverage > 0 Then
    decPerimeter = (decLength decWidth) * 2
    decArea = decPerimeter * decHeight

    'Call Private Sub CalcRolls
    Call CalcRolls(decArea, decRolls, decRollCoverage)


    'Display Output
    lblRolls.Text = decRolls.ToString
    Else

    'Display if number is not entered
    MessageBox.Show("Please enter a number")
    End If
    End If


    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    'ends the application
    Me.Close()
    End Sub

    Private Sub txtLength_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtLength.Enter
    txtLength.SelectAll()
    End Sub
    Private Sub txtWidth_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtWidth.Enter
    txtWidth.SelectAll()
    End Sub
    Private Sub txtHeight_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtHeight.Enter
    txtHeight.SelectAll()
    End Sub
    Private Sub txtRollCoverage_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtRollCoverage.Enter
    txtRollCoverage.SelectAll()
    End Sub

    Private Sub ClearLabel(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles txtLength.TextChanged, txtWidth.TextChanged, txtLength.TextChanged, txtRollCoverage.TextChanged
    lblRolls.Text = String.Empty
    End Sub


    End Class

Check out some similar questions!

How I calculate that what capacity modem I needed [ 0 Answers ]

I want to purchase a modem. But how I calculate that what capacity (1GB, 2GB such as) will be needed.

Broken up with my boyfriend because I just needed to be single again. [ 4 Answers ]

I broke up with my boyfriend of seven months today and even though it isn't very long but it has been the first relationship I have been in. I broke his heart and I knew from the beginning I would so that's why I put it off for long time. He has always been very dependent on me and extremely...

Is there a way to calculate a probable range for the next single datapoint? [ 3 Answers ]

Given a number of experimental results (n-datapoints), I find a range of reported values. I can use that set of data to calculate a confidence interval (t-distribution or normal). However, the confidence interval tells me nothing about the probable range that my next datapoint will fall within. ...

Calculate the number of mL of HCl [ 10 Answers ]

Calculate the number of mL of HCl reagent (36.0%, specific gravity = 1.18) that are needed to prepare one liter of 0.1M HCl solution. . Thanks advance. .

Single mens opinions NEEDED [ 6 Answers ]

Hey :o Im in a sticky situation and I need a guys advice on wha I should do. Here's a little back story... I met a guy through work (no longer works wit me) we clicked really well and our flirtyness became more physical. When I asked him why he been single so long he says he not looking for a...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.