I am using a 3rd-party class to create Scheduled Tasks. One of the methods of this class expected an Integer array to represent the days of the month.

For example
[VBCODE]
Dim trig As New MonthlyTrigger(Me.StartTime.Value.Hour, Me.StartTime.Value.Minute, {1,2,3,4}, MonthsOfTheYear.January)
[/CODE]

I have a form with 31 checkboxes to represent the days of the month and the user can select any or all of them. So I would like to create a sub called, say, GetMonthDays, that would check which checkboxes are checked and then build an integer array from it. However, I'm stuck.

I can use the text value of the checkbox and simply Cint/DirectCast it but how to add it to the integer array? Is there a better way to do this?

Code:
    Private Function GetDaysOfTheMonth() As Integer()

        Dim dom As Integer() = Nothing


        For Each C As Control In gb_MonthsDays.Controls
            If TypeOf C Is CheckBox Then
                Dim cb As CheckBox = DirectCast(C, CheckBox)
                If cb.Checked Then ??????????
            End If

        Next
        Return dom
    End Function