why will this program not build or run?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ron

    #1

    why will this program not build or run?

    I've got this simple program that will not build or run, any idea
    what I am doing wrong?

    Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal e
    As System.EventArg s) Handles btnCalculate.Cl ick
    Dim c As Double = CDbl(txtOrderCo st.Text)
    Dim r As Integer = CInt(txtMonthly Demand.Text)
    Dim p As Double = CDbl(txtPartCos t.Text)
    Dim f As Double = 0.15
    Dim h As Double = p * f
    Dim eoq As Double = 0

    eoq = (p / r) * 0.15 * 332100

    lblEOQ.Text = "EOQ = " & eoq

    End Sub

  • Newbie Coder

    #2
    Re: why will this program not build or run?

    A double is expection whole numbers & not 0.15

    try using 'Decimal' as the result instead of 'Double'

    Example:

    Dim eoq As Decimal = (p / r) * 0.15 * 332100
    lblEOQ.Text = "EOQ = " & eoq

    I haven't tried your code because you never gave any possible values for
    OrderCost, MonthlyDemand or PartCost

    --
    Newbie Coder
    (It's just a name)


    Comment

    • Stephany Young

      #3
      Re: why will this program not build or run?

      Well, if it won't compile (build) then it certainly won't run so the fact
      that it won't run is irrevalent.

      What compile-time error(s) are you getting?


      "Ron" <pts4560@yahoo. comwrote in message
      news:1171327952 .257787.296650@ v45g2000cwv.goo glegroups.com.. .
      I've got this simple program that will not build or run, any idea
      what I am doing wrong?
      >
      Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal e
      As System.EventArg s) Handles btnCalculate.Cl ick
      Dim c As Double = CDbl(txtOrderCo st.Text)
      Dim r As Integer = CInt(txtMonthly Demand.Text)
      Dim p As Double = CDbl(txtPartCos t.Text)
      Dim f As Double = 0.15
      Dim h As Double = p * f
      Dim eoq As Double = 0
      >
      eoq = (p / r) * 0.15 * 332100
      >
      lblEOQ.Text = "EOQ = " & eoq
      >
      End Sub
      >

      Comment

      • Ron

        #4
        Re: why will this program not build or run?

        OK here is what I have for the code now and it still will not load my
        form when I run it.

        Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal
        e As System.EventArg s) Handles btnCalculate.Cl ick
        Dim c As Double = CDbl(txtOrderCo st.Text)
        Dim r As Integer = CInt(txtMonthly Demand.Text)
        Dim p As Double = CDbl(txtPartCos t.Text)
        Dim f As Decimal = CDec(0.15)
        Dim h As Double = p * f
        Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)

        'for the eoq, use the below formula as a guide
        'replace with correct formula
        'eoq = CDec((p / r) * 0.15 * 332100)

        lblEOQ.Text = "EOQ = " & eoq

        End Sub
        FOR THE INPUTS I AM USING :
        order cost 25.00
        Monthly demand 90000
        Part cost 18.75
        Thats what I want to use but the form never opens for me to enter them
        in, I dont even get that far.



        On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@sp ammeplease.com>
        wrote:
        A double is expection whole numbers & not 0.15
        >
        try using 'Decimal' as the result instead of 'Double'
        >
        Example:
        >
        Dim eoq As Decimal = (p / r) * 0.15 * 332100
        lblEOQ.Text = "EOQ = " & eoq
        >
        I haven't tried your code because you never gave any possible values for
        OrderCost, MonthlyDemand or PartCost
        >
        --
        Newbie Coder
        (It's just a name)

        Comment

        • Ron

          #5
          Re: why will this program not build or run?

          On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo. comwrote:
          OK here is what I have for the code now and it still will not load my
          form when I run it.
          >
          Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal
          e As System.EventArg s) Handles btnCalculate.Cl ick
          Dim c As Double = CDbl(txtOrderCo st.Text)
          Dim r As Integer = CInt(txtMonthly Demand.Text)
          Dim p As Double = CDbl(txtPartCos t.Text)
          Dim f As Decimal = CDec(0.15)
          Dim h As Double = p * f
          Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)
          >
          'for the eoq, use the below formula as a guide
          'replace with correct formula
          'eoq = CDec((p / r) * 0.15 * 332100)
          >
          lblEOQ.Text = "EOQ = " & eoq
          >
          End Sub
          FOR THE INPUTS I AM USING :
          order cost 25.00
          Monthly demand 90000
          Part cost 18.75
          Thats what I want to use but the form never opens for me to enter them
          in, I dont even get that far.
          >
          On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@sp ammeplease.com>
          wrote:
          >
          >
          >
          A double is expection whole numbers & not 0.15
          >
          try using 'Decimal' as the result instead of 'Double'
          >
          The only error I get says the program has exited with e 0 (0x0)
          Example:
          >
          Dim eoq As Decimal = (p / r) * 0.15 * 332100
          lblEOQ.Text = "EOQ = " & eoq
          >
          I haven't tried your code because you never gave any possible values for
          OrderCost, MonthlyDemand or PartCost
          >
          --
          Newbie Coder
          (It's just a name)- Hide quoted text -
          >
          - Show quoted text -

          Comment

          • Tony K

            #6
            Re: why will this program not build or run?

            Hmmm. I just created a new project in VB 2005 and craeted the 3 text boxes
            that you listed, the one label, and the calculate button. I did not have
            any problems at all running the program. It would take all but 3 minutes,
            have you tried creating a completely new project and trying this again?

            Tony

            "Ron" <pts4560@yahoo. comwrote in message
            news:1171330761 .738031.61140@m 58g2000cwm.goog legroups.com...
            On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo. comwrote:
            >OK here is what I have for the code now and it still will not load my
            >form when I run it.
            >>
            > Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal
            >e As System.EventArg s) Handles btnCalculate.Cl ick
            > Dim c As Double = CDbl(txtOrderCo st.Text)
            > Dim r As Integer = CInt(txtMonthly Demand.Text)
            > Dim p As Double = CDbl(txtPartCos t.Text)
            > Dim f As Decimal = CDec(0.15)
            > Dim h As Double = p * f
            > Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)
            >>
            > 'for the eoq, use the below formula as a guide
            > 'replace with correct formula
            > 'eoq = CDec((p / r) * 0.15 * 332100)
            >>
            > lblEOQ.Text = "EOQ = " & eoq
            >>
            > End Sub
            >FOR THE INPUTS I AM USING :
            >order cost 25.00
            >Monthly demand 90000
            >Part cost 18.75
            >Thats what I want to use but the form never opens for me to enter them
            >in, I dont even get that far.
            >>
            >On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@sp ammeplease.com>
            >wrote:
            >>
            >>
            >>
            A double is expection whole numbers & not 0.15
            >>
            try using 'Decimal' as the result instead of 'Double'
            >>
            The only error I get says the program has exited with e 0 (0x0)
            >
            Example:
            >>
            Dim eoq As Decimal = (p / r) * 0.15 * 332100
            lblEOQ.Text = "EOQ = " & eoq
            >>
            I haven't tried your code because you never gave any possible values
            for
            OrderCost, MonthlyDemand or PartCost
            >>
            --
            Newbie Coder
            (It's just a name)- Hide quoted text -
            >>
            >- Show quoted text -
            >
            >

            Comment

            • Patrice

              #7
              Re: why will this program not build or run?

              Describing what happens in the first place is always a good idea ;-)

              For now it would make me thought that you just show the form. But showing
              the form doesn't mean that control is necessarily transfered to the form. In
              this case the program just continues and ends...

              What is your startup object ? IMO the relevant code is the code that launch
              the forms...

              "Ron" <pts4560@yahoo. coma écrit dans le message de news:
              1171330761.7380 31.61140@m58g20 00...legro ups.com...
              On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo. comwrote:
              >OK here is what I have for the code now and it still will not load my
              >form when I run it.
              >>
              > Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal
              >e As System.EventArg s) Handles btnCalculate.Cl ick
              > Dim c As Double = CDbl(txtOrderCo st.Text)
              > Dim r As Integer = CInt(txtMonthly Demand.Text)
              > Dim p As Double = CDbl(txtPartCos t.Text)
              > Dim f As Decimal = CDec(0.15)
              > Dim h As Double = p * f
              > Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)
              >>
              > 'for the eoq, use the below formula as a guide
              > 'replace with correct formula
              > 'eoq = CDec((p / r) * 0.15 * 332100)
              >>
              > lblEOQ.Text = "EOQ = " & eoq
              >>
              > End Sub
              >FOR THE INPUTS I AM USING :
              >order cost 25.00
              >Monthly demand 90000
              >Part cost 18.75
              >Thats what I want to use but the form never opens for me to enter them
              >in, I dont even get that far.
              >>
              >On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@sp ammeplease.com>
              >wrote:
              >>
              >>
              >>
              A double is expection whole numbers & not 0.15
              >>
              try using 'Decimal' as the result instead of 'Double'
              >>
              The only error I get says the program has exited with e 0 (0x0)
              >
              Example:
              >>
              Dim eoq As Decimal = (p / r) * 0.15 * 332100
              lblEOQ.Text = "EOQ = " & eoq
              >>
              I haven't tried your code because you never gave any possible values
              for
              OrderCost, MonthlyDemand or PartCost
              >>
              --
              Newbie Coder
              (It's just a name)- Hide quoted text -
              >>
              >- Show quoted text -
              >
              >

              Comment

              • Newbie Coder

                #8
                Re: why will this program not build or run?

                Ron

                I have used the values you have given me & I get the result of: 'EOQ =
                103.78125'

                Here is the code:

                Dim c As Double = 25.00
                Dim r As Integer = 9000
                Dim p As Double = 18.75
                Dim f As Double = 0.15
                Dim h As Double = p * f
                Dim eoq As Double = CDbl((p / r) * 0.15 * 332100)
                TextBox1.Text = "EOQ = " & eoq

                The code compiles for me ok with no errors

                Maybe you don't need 5 decimal places then it could be formatted simply by:

                TextBox1.Text = "EOQ = " & Format(eoq, "#.###")
                Result: 'EOQ = 103.781'

                This will give you the whole number & then to 3 decimal places:

                TextBox1.Text = "EOQ = " & Format(eoq, "#.##")
                Result: 'EOQ = 103.78'

                The above to 2 decimal places & so on

                I hope this helps,

                --
                Newbie Coder
                (It's just a name)


                Comment

                • Ron

                  #9
                  Re: why will this program not build or run?

                  thanks everyone. I started a new project and redid it and it compiled
                  fine.

                  On Feb 13, 11:46 am, "Newbie Coder" <newbieco...@sp ammeplease.com>
                  wrote:
                  Ron
                  >
                  I have used the values you have given me & I get the result of: 'EOQ =
                  103.78125'
                  >
                  Here is the code:
                  >
                  Dim c As Double = 25.00
                  Dim r As Integer = 9000
                  Dim p As Double = 18.75
                  Dim f As Double = 0.15
                  Dim h As Double = p * f
                  Dim eoq As Double = CDbl((p / r) * 0.15 * 332100)
                  TextBox1.Text = "EOQ = " & eoq
                  >
                  The code compiles for me ok with no errors
                  >
                  Maybe you don't need 5 decimal places then it could be formatted simply by:
                  >
                  TextBox1.Text = "EOQ = " & Format(eoq, "#.###")
                  Result: 'EOQ = 103.781'
                  >
                  This will give you the whole number & then to 3 decimal places:
                  >
                  TextBox1.Text = "EOQ = " & Format(eoq, "#.##")
                  Result: 'EOQ = 103.78'
                  >
                  The above to 2 decimal places & so on
                  >
                  I hope this helps,
                  >
                  --
                  Newbie Coder
                  (It's just a name)

                  Comment

                  • Newbie Coder

                    #10
                    Re: why will this program not build or run?

                    Glad you had a result, Ron

                    --
                    Newbie Coder
                    (It's just a name)


                    Comment

                    • Larry Linson

                      #11
                      Re: why will this program not build or run?

                      dotnet is too verbose; your IDE is expecting more verbosity

                      I would reccomend just adding a whole assload of more code in it and
                      see if it works then



                      On Feb 12, 4:52 pm, "Ron" <pts4...@yahoo. comwrote:
                      I've got this simple program that will not build or run, any idea
                      what I am doing wrong?
                      >
                      Private Sub btnCalculate_Cl ick(ByVal sender As System.Object, ByVal e
                      As System.EventArg s) Handles btnCalculate.Cl ick
                      Dim c As Double = CDbl(txtOrderCo st.Text)
                      Dim r As Integer = CInt(txtMonthly Demand.Text)
                      Dim p As Double = CDbl(txtPartCos t.Text)
                      Dim f As Double = 0.15
                      Dim h As Double = p * f
                      Dim eoq As Double = 0
                      >
                      eoq = (p / r) * 0.15 * 332100
                      >
                      lblEOQ.Text = "EOQ = " & eoq
                      >
                      End Sub

                      Comment

                      Working...