Hi Paul, something to ponder while watching football tomorrow!
I have an app with a MonthCalendar control on the main form and another on a child form. The child form also has 2 DateTimePicker controls and a ListBox control and 2 TextBoxes. I call the child form from a mouse click or a keyboard keypress on a main form ListView row. When the form opens, 1 of the 2 TextBoxes and neither of the DateTimePicker controls can get focus or be edited and the main form Calendar control gets hidden.
Mouse over the child form's ListBox control (or click the MonthCalendar control) and the main form Calendar control appears/shows and the TextBox and the 2 DateTimePicker controls all function normally.
I experimented with the TabIndex but that made no difference.
Here is my workaround:
' Do a check to ensure that this is actually a window handle (FF)
Dim hw as HWND = frmJedit.mcMoveJournalEntry.hWindow
If IsWindow(hw) Then
frmJedit.mcMoveJournalEntry.SelectedDate = Format( js( jdb.RecPtr).Dai, "yyyyMMdd")
' Set the focus to frmJedit.mcMoveJournalEntry ' the child form's MonthCalendar control
SetFocus hw
' Virtually hit the Enter key to enable the 2 datepicker controls and the...
keybd_event VK_RETURN, 0, 0, 0
keybd_event VK_RETURN, 0, KEYEVENTF_KEYUP, 0 ' Release the ENTER key
End If