none
The form referred to itself during construction from a default instance, which led to infinite recursion. Within the Form's constructor refer to the form using 'Me.' RRS feed

  • Question

  • hello!

    How can i avoid this kind of error on my system. When I click a button that shows another form a multiple times this error occur.

    an error occur in this part:

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            Crystalreport.Show()
    
        End Sub
    Thankyou so much!

    Monday, August 27, 2018 11:27 AM

Answers

  • Did you create the form like 

    Dim f As New SomeForm ?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by euchan09 Monday, August 27, 2018 12:01 PM
    Monday, August 27, 2018 11:34 AM
    Moderator
  • it works but when i close the form then click again the button this error occur:

     Cannot access a disposed object



    Each time you want to show the form and have closed it you need to repeat the creation of the form.

    I have a stock code sample that shows how to create, close, detect if closed and open and if open show it.

    https://1drv.ms/u/s!AtGAgKKpqdWjiCMVgSj58ltBc3Di


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites


    Monday, August 27, 2018 11:55 AM
    Moderator

All replies

  • Did you create the form like 

    Dim f As New SomeForm ?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by euchan09 Monday, August 27, 2018 12:01 PM
    Monday, August 27, 2018 11:34 AM
    Moderator
  • i did not. wait ill try to do it.

    • Edited by euchan09 Monday, August 27, 2018 11:46 AM
    Monday, August 27, 2018 11:45 AM
  • it works but when i close the form then click again the button this error occur:

     Cannot access a disposed object



    • Edited by euchan09 Monday, August 27, 2018 11:53 AM
    Monday, August 27, 2018 11:52 AM
  • it works but when i close the form then click again the button this error occur:

     Cannot access a disposed object



    Each time you want to show the form and have closed it you need to repeat the creation of the form.

    I have a stock code sample that shows how to create, close, detect if closed and open and if open show it.

    https://1drv.ms/u/s!AtGAgKKpqdWjiCMVgSj58ltBc3Di


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites


    Monday, August 27, 2018 11:55 AM
    Moderator
  • thank you!
    Monday, August 27, 2018 12:01 PM