我用下面的代码为怎么总是提出错误
Private Sub Timer2_Timer()
Static i As Integer
i = (i + 1) Mod 2 '2 为图画框的个数
'就是下面这句.不知道错在哪里,哪位高手指点一下
SetTrayIcon (MainForm.Picture2(i).Picture)
Timer2.Enabled = True
End Sub以下是放在模块中的
Public Sub SetTrayIcon(pic As Picture)
    ' Do nothing if the picture is not an icon.
    If pic.Type <> vbPicTypeIcon Then Exit Sub    ' Update the tray icon.
    With TheData
        .hIcon = pic.Handle
        .uFlags = NIF_ICON
    End With
    Shell_NotifyIcon NIM_MODIFY, TheData
End Sub