# Trying to figure out how to calculate

Page 1 of 1

## 4 Replies - 364 Views - Last Post: 04 October 2017 - 03:30 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=406650&amp;s=ed12d19aeaa48781c2a8e55b18fe93b2&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 amck2017

Reputation: 0
• 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]
```
/>
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

• D.I.C Regular

Reputation: 57
• 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'

### #3 amck2017

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

## Re: Trying to figure out how to calculate

Posted 03 October 2017 - 10:18 AM

PeterH, 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'

amck2017, on 03 October 2017 - 10:17 AM, said:

PeterH, 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

### #4 andrewsw

• the case is sol-ved

Reputation: 6379
• 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.

### #5 PeterH

• D.I.C Regular

Reputation: 57
• 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.