Multiple Forms, Array Forms.

tcomputerchip

Member
Joined
Nov 6, 2002
Messages
13
Location
MA
I want to be able to store all the iterations of the frmStatus in an object array, similar to if you had mutible documents opened in MS Word. I want to be able to call the forms though the array collection so that I can open and close them as needed.

The project is setup with MDI Parent (frmServer) and MDI Child (frmStatus) [set in code].


When I check the Status(AvailableID) that it should have created the Object is still set to Nothing.

This is what I have so far.

Code:
Global Vars

    Dim Status() As frmStatus
    Dim AvailableID As Integer

Sub In question?

Private Sub mnuShowMDI_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles mnuShowMDI.Click
        On Error Resume Next
        Dim FoundAvailable As Boolean

        FoundAvailable = False
        Do Until FoundAvailable = True

            If Status(AvailableID) Is Nothing Then Force Error
                FoundAvailable = True
            End If
            AvailableID = AvailableID + 1
        Loop
        Status(AvailableID) = New frmStatus()

        Status(AvailableID).MdiParent = Me
        If AvailableID = 1 Then
            Status(AvailableID).Text = ":New Status Window"
        Else
            Status(AvailableID).Text = ":New Status Window[" & AvailableID & "]"
        End If

        Status(AvailableID).Show()
    End Sub
 
Hey, you dont need to batter my code. This is my 4th program I am revising from over 50,000 lines of code. Im not worried about error trapping at this point. I know how to find the error.

I have never used any of the new programming structure so I did not know about Try/Catch. If you are willing explain what you are so eger to bash I would be greatfull.

Also, I do not know what you are talking about with the Redemension of the Array. I know how to do it in VB 6 but I though ReDim was removed from .NET.

Please explain in more detail.
 
ReDim is still alive and kickin in .NET, and it works the same
way (ReDim theArray(newArraySize)), along with ReDim Preserve.
 
Code:
Dim iInteger As Integer

Try
    Cause a divide by zero error
    iInteger = 7 / 0
Catch e As DivideByZeroException
    Catch the error
Catch ex As Exception
    Catch other errors
End Try
 
Back
Top