I have to use a basic ByRef and ByVal in a program and its not showing up in the labels when I hit the calculate button. The program I am creating is very basic and it calculates your age, nextyear age, month born, astrological sign, days old and seconds old.
I know how to calculate most all but, am stuggling with my ByRef and ByVal.
Here is the snippet of the code I am struggling with:
Private Sub ageNextYear(ByVal nextYearage As Integer)
nextYearage = currentAge + 1
Me.lblnextYearAge.Text = nextYearage.ToString
End Sub
Private Sub Yourdays(ByVal lbldaysOld)
lbldaysOld.text = lblcurrentAge.Text * 365
End Sub
Private Sub yourSeconds(ByVal lblsecondsOld)
lblsecondOld.Text = lbldaysOld.Text * 86400
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Call ageNextYear(currentAge)
currentAge = System.DateTime.Now.Year - Me.txtYear.Text
lblcurrentAge.Text = currentAge.ToString
Call ageNextYear(currentAge)
lblnextYearAge.Text = nextYearAge.ToString
When I run the program it displays the next year age as zero and does not display the seconds or days old.
I have attatched a picture to show what happens.
Any help would be appreciated, as I am VERY bad at coding. :(
Thank you!