Using Switch to determine number of days in month

I am taking user input to day, month and year. Would like to use a switch to determine whether a month would have 28/29, 30 or 31 days, given on the month selected but I am a bit confused as to how to use it.
I would take the month as a string “MM” and based on the month would give an array of days to chose from.

Hi @Nelson.R

please use DateTime.DaysInMonth(2005,1) method which will give days in a month.
No need to use Switch condition here.

put this in message box to check immediately.

Two parameters you need to pass.

  1. first is year as interger(2005, 2006,2020)
  2. Second month as interger(1- Jan, 2- Feb, 3 - Mar, … , 12 - Dec).

then it will give days in month.

Regards,
Vijay.

2 Likes

Thank you

I would like to create a list and put the days in the month into the options inside an Input Dialog.

So the list would be all the days in month. I using a while loop to get each day from 1 to the number of days in the month, however I am getting an error when I try using the add to collection activity.

Value of type 'System.Collections.Generic.List(Of String) cannot be converted to ‘1-dimensional array of string’.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.