Results 1 to 2 of 2

Thread: Assigning a form to a variable

  1. #1


    I have a dynamic array of form variables that I use to handle and manipulate then so that I can have several of them open at once. However whenever a user closes one of them I need to unload the form, move the others down in the array, and ReDim Preserve to accomidate. I use this code to do so:

    Public Sub RemovePrivateMessageForm(removeindex As Integer)
    Dim Temp(1 To 1024) As frmPrivateMessage
    Dim Counter As Integer

    For Counter = 1 To iPrivateMessage
    If Counter <> removeindex Then
    * Temp(Counter) = oPrivateMessage(Counter)
    End If
    Next Counter

    For Counter = 1 To iPrivateMessage
    oPrivateMessage(Counter) = Temp(Counter)
    Next Counter

    ReDim Preserve oPrivateMessage(1 To iPrivateMessage) As frmPrivateMessage
    End Sub

    The line I put the * at the beginning of is the one that is causing me problems. I get the error:
    Function or interface marked restricted, or function uses an automation type not supported by Visual Basic.
    I'm not using automation at all, and this isn't restricted, so I'll assume that VB is misinterpriting my intentions. I'm going to assume that you can't assign a form to a variable, and if you can do it you can't do it like this. So, how do I do it?

    Thanx a bunch!

  2. #2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width