Author Topic: code to minimize running program  (Read 1027 times)

Douglas

  • Newbie
  • *
  • Posts: 5
    • View Profile
code to minimize running program
« on: December 27, 2019, 09:41:25 AM »
Im trying to find a way to minimize my running program. I know there is the sizable form border but I have that set to none because If you click the X it leaves some of the program running with now no way to stop it except from task manager. What I think would work good for me is to use a basic button click to minimize it.

    "Private Sub BasicButton5_Click(sender As Object, e As EventArgs) Handles BasicButton5.Click
     ?????????????????????
     End Sub"
Any suggestions on the code to put in there? or maybe there is a better way.
Thanks in advance

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5262
    • View Profile
    • AdvancedHMI
Re: code to minimize running program
« Reply #1 on: December 27, 2019, 09:53:53 AM »
Maybe this:

Me.WindowState = FormWindowState.Minimized

Douglas

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: code to minimize running program
« Reply #2 on: December 27, 2019, 09:58:47 AM »
Yes that did the trick, Thank you very much Archie!!

Phrog30

  • Guest
Re: code to minimize running program
« Reply #3 on: December 27, 2019, 10:30:26 AM »
... If you click the X it leaves some of the program running with now no way to stop it except from task manager...

I would take the time to fix that issue, that is not right.

Douglas

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: code to minimize running program
« Reply #4 on: December 27, 2019, 01:38:52 PM »
... If you click the X it leaves some of the program running with now no way to stop it except from task manager...

I would take the time to fix that issue, that is not right.
Im not sure how i would fix this, the problem is i have a few pages that do trending, so i when i close that page it forgets all the trend data, so what i do is just hide it when switching pages. But with doing this its always running in the background and the entire project wont close with form x button. I have an exit button that closes all the open pages. There very well could be a better way, Im not very good with this type of programming. im defiantly open to suggestions 

Phrog30

  • Guest
Re: code to minimize running program
« Reply #5 on: December 28, 2019, 10:10:57 AM »
Feel free to look at one of my projects I have shared, but the concept is to put code that needs to run all of the time on a form that is open all of the time.  Almost every project will have a header, footer, nav bar, etc.  Put your code in there.