Results 1 to 9 of 9

Thread: Multiple Forms Question [Resolved]

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Ft. Lauderdale, FL
    Posts
    33

    Question Multiple Forms Question [Resolved]

    Hello,

    This might be a really dumb question so please bear with me!!

    I'm just starting with vb.net. I have an app with two forms. the first form has a menu item which opens up the second form.

    Code in first Form:

    Code:
    Public Class Form1
           Dim frmViewSelected As New frmViewSelImgs()
    '
    ' Bunch o' Code
    '
    ' Click Event For Menu Item
    Private Sub mnuViewSelectedImgs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuViewSelectedImgs.Click
            With frmViewSelected
                .myImgArray = UploadArray
                .Show()
                .Focus()
            End With
        End Sub
    This works ok ... until I close the second window and then try to open it again. I get an error saying that I can't acces an object that has been disposed - something like that.

    It seems to me that when form1 loads it creates the frmViewSelected object --- but when that window is closed the object is destroyed or disposed of and the main form dosen't know what object frmViewSelected is.

    Is there a better way to do this? This method was suggested by a .net book. It was the only way suggested.

    Thanks!

    -Rich
    Last edited by Richdef; Feb 7th, 2003 at 10:27 AM.
    Rich J Defilippo

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