Results 1 to 2 of 2

Thread: [RESOLVED] Tell Form1 that Form2 is closed

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2021
    Posts
    69

    Resolved [RESOLVED] Tell Form1 that Form2 is closed

    I have a complicated question about two forms.
    Form1 contains a Listview with document names. I click a button which opens Form2. In Form2 I show duplicate documents. When I click OK these duplicates are deleted. The Form2 is then closed.
    When I return to Form1 I want the Listview updated. So clear it and add the documenst which were left (not deleted).

    How does Form1 know that Form2 was closed and thus the Listview should be updated?

    Breaking my head.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,682

    Re: [RESOLVED] Tell Form1 that Form2 is closed

    Instead of showing Form2 using the .Show method, use the .ShowDialog method, as that will cause the code in Form1 to pause while Form2 is visible (you can put the code to update the listview just after the ShowDialog call).

    Documentation for ShowDialog:
    https://docs.microsoft.com/en-us/dot...g?view=net-5.0

Tags for this Thread

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