For Section 3.3 Exercise 82, why is the solution not viewable? I am having probl
ID: 3880235 • Letter: F
Question
For Section 3.3 Exercise 82, why is the solution not viewable? I am having problem checking to see where I've made my mistake. I am not getting results I need in the program.
Here is the code I used:
Public Class frmValentinesDay
Private Sub btnDay_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim valentineday As Integer = CDate(txtYear.Text)
Dim valentineday As Date = CDate("2/14/" & enteredYear)
txtResult.Text = valentineday.ToString("dddd") & "February 14 "
End Sub
Why am I not able to see the year I am using. I get the Day and the Date, but the years does not populate. Please Help
Explanation / Answer
Dim valentineday As Integer = CInt(txtYear.Text)
Dim valentineday As Date = CDate("2/14/" & enteredYear)
You are using the same variable name for year and date.
Corrected code:
Private Sub btnDay_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim valentineyear As Integer = CInt(txtYear.Text)
Dim valentineday As Date = CDate("2/14/" & valentineyear)
txtResult.Text = valentineday.ToString("dddd") & "February 14 "
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.