I am trying to display the current year and the next year
in a label. I manage to show the current year using SY.Text = Date.Now.Year
but how can I show the next year too? For example the current year is 2017. I want to show it as:
S.Y: 2017-2018
how can I do this?
Here approach with correct typing
Dim nowYear As Integer = Date.Now.Year
Label.Text = $"School year: {nowYear} - {nowYear + 1}"
In case you not using Roslyn compiler (older then Visual Studio 2015)
Label.Text = String.Format("School year: {0} - {1}", nowYear, nowYear + 1)
Do not use +
as concatenate operator for strings, instead use &
operator in vb.net.
Set Option Strict On
in your project or write it in the first line of your code file. This option will help you recognize possible type conversion errors during compile time