4 Replies - 364 Views - Last Post: 04 October 2017 - 03:30 AM Rate Topic: -----

#1 amck2017  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-August 17

Trying to figure out how to calculate

Posted 03 October 2017 - 08:47 AM

Having been trying to solve this, have most of the program done except the calculation will not activate. Gone over and over to see what the problem is and have cleared all errors from before but still no calculation
[/Public Class Recordingstudio
    Private TotalNumberSumInteger, AveragesumInteger As Integer
    Private GroupSumInteger, MinCountInteger As Integer
    Const Studio_Rent_Integer As Integer = 200
    Private printRecordingstudio As Object
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles btnExitButton.Click
        Me.Close()
    End Sub

    Private Sub btnCalculateButton_Click(sender As Object, e As EventArgs) Handles btnCalculateButton.Click
        Dim TotalNumber As Integer
        Dim GroupCharges As Integer
        Dim TotalNumberInteger, AverageInteger, TotalChargesInteger, GroupInteger, MinInteger As Integer
        'Convert
        GroupInteger = Integer.Parse(GroupChargesTextBox.Text)
        MinInteger = Integer.Parse(MinTextBox.Text)
        'Calculate
        TotalChargesInteger = GroupInteger * MinInteger
        'Display
        TotalNumberGroupTextBox.Text = TotalNumberInteger.ToString("C")
        AverageTextbox.Text = AverageInteger.ToString("N")
        TotalChargesbox.Text = TotalChargesInteger.ToString("C")
    End Sub
    Private Sub btnClearbutton_Click(sender As Object, e As EventArgs) Handles btnClearbutton.Click
        AverageTextbox.Clear()
        GroupChargesTextBox.Clear()
        MinTextBox.Clear()
        GroupChargesTextBox.Clear()
        TotalNumberGroupTextBox.Clear()
        With Grouptextbox
            .Clear()
            .Focus()
        End With
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Grouptextbox.Clear()
        MinTextBox.Clear()
        TotalNumberGroupTextBox.Clear()
    End Sub
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnPrintbutton.Click
        'Print the form
        printRecordingstudio.printaction = Printing.PrintAction.PrintToPreview
        printRecordingstudio.print()

    End Sub
End Class]
:code:/>
mod: giant quote removed
When you hit calculate all it does is rest all to zero instead of calculating the time * charge

This post has been edited by modi123_1: 03 October 2017 - 08:49 AM
Reason for edit:: In the future select the text that is code and click the [code] tag button in the editor.


Is This A Good Question/Topic? 0
  • +

Replies To: Trying to figure out how to calculate

#2 PeterH  Icon User is offline

  • D.I.C Regular

Reputation: 57
  • View blog
  • Posts: 279
  • Joined: 03-September 09

Re: Trying to figure out how to calculate

Posted 03 October 2017 - 09:51 AM

Have you set a breakpoint at line 15 and checked what values you have in GroupInteger and MinInteger, these are the only variables that are being assigned from your inputs all the others will remain as '0' because they are declared in the sub and will default to '0'
Was This Post Helpful? 0
  • +
  • -

#3 amck2017  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-August 17

Re: Trying to figure out how to calculate

Posted 03 October 2017 - 10:18 AM

View PostPeterH, on 03 October 2017 - 09:51 AM, said:

Have you set a breakpoint at line 15 and checked what values you have in GroupInteger and MinInteger, these are the only variables that are being assigned from your inputs all the others will remain as '0' because they are declared in the sub and will default to '0'


View Postamck2017, on 03 October 2017 - 10:17 AM, said:

View PostPeterH, on 03 October 2017 - 09:51 AM, said:

Have you set a breakpoint at line 15 and checked what values you have in GroupInteger and MinInteger, these are the only variables that are being assigned from your inputs all the others will remain as '0' because they are declared in the sub and will default to '0'

Set the breakpoint at line 15 have not set in values to both integers
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6379
  • View blog
  • Posts: 25,774
  • Joined: 12-December 12

Re: Trying to figure out how to calculate

Posted 03 October 2017 - 11:24 AM

You do not have to fumble about with the Quote feature, there is a Reply button further down the page, or use the Fast Reply box.
Was This Post Helpful? 0
  • +
  • -

#5 PeterH  Icon User is offline

  • D.I.C Regular

Reputation: 57
  • View blog
  • Posts: 279
  • Joined: 03-September 09

Re: Trying to figure out how to calculate

Posted 04 October 2017 - 03:30 AM

Not sure what you mean by 'have not set in values to both integers', stepping through the two lines 15 and 16 will or should set the values into GroupInteger and MinInteger which I assume relate to time and charge. When you do this, what values do GroupInteger and MinInteger have when you get to line 18. Your code assumes that the text input fields are populated with values and those values will convert to integers.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1