Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

 

'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

Posted

Hey, you don't 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.

  • *Experts*
Posted

ReDim is still alive and kickin' in .NET, and it works the same

way (ReDim theArray(newArraySize)), along with ReDim Preserve.

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...