October 16th, 2013, 07:35 PM
[RESOLVED] Help incrementing a variable please.
I hope I'm posting in the correct forum.
I have the variable dblCalories += 19.5 which I am using in a For Next Loop. I need to have dblCalories start out at the number 39...NOT 19.5, and then add 19.5 to 39 and so on. Make sense I hope? Here is my code. IF you run it, you will see that it is showing 19.5 in the first output but what I need it to start out showing is 39...and then go up by 19 from there up. Thanks for any help.
Public Class Form1
Private Sub btnRunDemo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunDemo.Click
Dim intCount As Integer ' Loop counter
Dim dblCalories As Double ' To hold calories
Dim strTemp As String ' To hold output
' Initiate count at 5 and Step 5
For intCount = 5 To 30 Step 5
' Calculate the calories of dblCalories.
dblCalories += 19.5
' Create a string to display.
strTemp = "The number of calories burned for " & intCount.ToString() & " minutes" &
" is " & dblCalories.ToString()
' Add the string to the list box.
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
' Clear the list box.
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
' Close the form.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!