Results 1 to 2 of 2

Thread: Cannot access a disposed object "Listbox"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    US
    Posts
    68

    Cannot access a disposed object "Listbox"

    Hey i got a search form in which i get a file name, pass to a friend function on my mainform, like such

    ''search form

    'On Error Resume Next
    Dim frm As ExpoSecServer = Me.Owner
    Dim sName As String
    sName = LB.SelectedItems.Item(0)
    frm.LoadSearchResults(sName)
    Me.Close()

    'MainForm function

    Friend Function LoadSearchResults(ByVal sPath As String)
    'On Error Resume Next

    If Trim(sPath) = "" Then Exit Function

    LB.Items.Clear()
    LB.Items.Add(sPath)

    LB.Load(strFilePath & sPath, 20, 1, 1)
    lblImage.Text = sPath
    LV.Items.Add(sPath)
    LB.VScrollInfo.Pos = LD.VScrollInfo.Max \ 3.8

    If Err.Number <> 0 Then MessageBox.Show("Error Description : " & Err.Description, "Error Handler", MessageBoxButtons.YesNo, MessageBoxIcon.Error)

    End Function

    any idea why i crash, message is "Cannot access a disposed object named "ListBox" it loads image, and nowhere do i dispose my listbox, am i doing the owned form method wrong?
    Last edited by NeonBurner; Dec 18th, 2003 at 08:28 AM.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    US
    Posts
    68
    why does the mainform try to call the disposed listbox on the search form after the doubleclick event? if i put the search code in a button it works fine?
    Last edited by NeonBurner; Dec 18th, 2003 at 08:27 AM.

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