this code always return ‘0’ i don’t know why
Dim cur_month = DatePart(DateInterval.Month, Now).ToString()
Dim cur_date As String = "01/" + cur_month + "/" + (DatePart(DateInterval.Year, Now).ToString)
Dim sel_date As String = "01/" + (cmb_mnth.SelectedIndex + 1).ToString + "/" + txt_year.Text.ToString
Dim date_dif As String = DateDiff(DateInterval.Month, CDate(sel_date), CDate(cur_date))
MsgBox(date_dif)
cnb_mnth is ComboBox for Month
txt_year is Text Box For Entering Year
I’d guess that the regional date settings on your computer has month before day (i.e., MM/dd/yyyy), so it interprets 01 as the month for both cur_date and sel_date.