0

Good day developers,

I just want to ask if it is possible, once I clicked a button, it appearing the new windows form only once, because as of now it works for me but when I clicked a button many times it appear the windows form multiple times. Is that possible? (Sorry for my english :D)

This is my code:

Private Sub Button_ItemClick(sender As Object, e As ItemClickEventArgs) Handles Button.ItemClick
        Dim newForm As New MyForm
        newForm.Show()
    End Sub
  • Before you open anew form check with openforms if it is already open – nbk May 12 '23 at 08:13
  • @nbk I need to open that because its a part of the system. – DeveloperGuy May 12 '23 at 08:25
  • And? you check before hand of your form is open with https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.applicationservices.windowsformsapplicationbase.openforms?view=windowsdesktop-7.0 and if not start a new one else set the focues on it – nbk May 12 '23 at 08:32
  • https://stackoverflow.com/a/15439568/14171304 – dr.null May 12 '23 at 10:41
  • 1
    Possible that maybe newForm.ShowDialog() might also be what you're needing. That will allow you to stop focus going back to the original calling form until newForm is closed – Hursey May 14 '23 at 20:44

0 Answers0