I have this in VB6
Code:
Private Sub LoadDaysOfMonth(pintWhatMonth As Integer, pctrlWhatControl As Control)
Dim NumOfDays As Integer
Dim i As Integer
Select Case pintWhatMonth
Case 1, 3, 5, 7, 8, 10, 12
NumOfDays = 31
Case 4, 6, 9, 11
NumOfDays = 30
Case 2
NumOfDays = 28
End Select
For i = 1 To NumOfDays
pctrlWhatControl.AddItem pintWhatMonth & "/" & i & "/" & Year(Now)
Next
End Sub
Private Sub Command1_Click()
LoadDaysOfMonth 10, List1
LoadDaysOfMonth 2, Combo1
End Sub
Works like a champ.
So, I try to translate this into VB.NET
Code:
Private Sub LoadDaysOfMonth(ByVal pintWhatMonth As Integer, ByVal pctrlWhatControl As Control)
Dim NumOfDays As Integer
Select Case pintWhatMonth
Case 1, 3, 5, 7, 8, 10, 12
NumOfDays = 31
Case 4, 6, 9, 11
NumOfDays = 30
Case 2
NumOfDays = 28
End Select
For i As Integer = 1 To NumOfDays
pctrlWhatControl.items.add(pintWhatMonth & "/" & i & "/" & Year(Now))
Next
End Sub
But, now an error comes

Originally Posted by
Error
'items' is not a member of Systems.Windows.Forms.Control
It works just fine if I use pctrlListBox As ListBox or if I use pctrlCombo As ComboBox, but I need to be able to use both with the same routine.
(PS: Yes, I do have a leap year check in here which I took out as it is not germine to my translation problem.)
(PPS: Using a control such as the monthview or datepicker is not an option.)