You are viewing our Forum Archives. To view or take place in current topics click here.
Visual basic program help
Posted:

Visual basic program helpPosted:

RockstarGames
  • Supporter
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
I have made a program but i want to to always to be at the front over all other applications are open. So if i click google chrome the application will still be there and not dissapear.

If anyone knows what code i would need todo or point me in the right direction.

Thanks

made in C++
#2. Posted:
ProJimmyRustler
  • V5 Launch
Status: Offline
Joined: Jul 14, 20149Year Member
Posts: 1,720
Reputation Power: 71
Status: Offline
Joined: Jul 14, 20149Year Member
Posts: 1,720
Reputation Power: 71
Read the title and saw "Visual Basic". Then the post said C++.

Ignore this
If by default you want this, it should be in the options.

Here is a manual way to do it.
Form.TopMost = true;


If you want it user-driven
create a checkbox named chkAlwaysOnTop of course. It can also be easily stored in the user settings to keep it state-aware between instances.

Private Sub chkAlwaysOnTop_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAlwaysOnTop.CheckedChanged
    Me.TopMost = chkAlwaysOnTop.Checked           
End Sub
You'll want this in your program if you want to save said state for the user:

Private Sub MainActivity_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    My.Settings.AlwaysOnTop = chkAlwaysOnTop.Checked
    My.Settings.Save()
End Sub
You'll also want this in your form load:

 Me.TopMost = My.Settings.AlwaysOnTop
 chkAlwaysOnTop.Checked = My.Settings.AlwaysOnTop


Here is info for C++
[ Register or Signin to view external links. ]

For future reference Visual Basic is a language. Visual STUDIO is what you are using to make programs.


Last edited by ProJimmyRustler ; edited 1 time in total
#3. Posted:
RockstarGames
  • Summer 2020
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
Status: Offline
Joined: Dec 23, 200914Year Member
Posts: 1,937
Reputation Power: 347
ProJimmyRustler wrote If by default you want this, it should be in the options.

Here is a manual way to do it.
Form.TopMost = true;


If you want it user-driven
create a checkbox named chkAlwaysOnTop of course. It can also be easily stored in the user settings to keep it state-aware between instances.

Private Sub chkAlwaysOnTop_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles chkAlwaysOnTop.CheckedChanged
    Me.TopMost = chkAlwaysOnTop.Checked           
End Sub
You'll want this in your program if you want to save said state for the user:

Private Sub MainActivity_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    My.Settings.AlwaysOnTop = chkAlwaysOnTop.Checked
    My.Settings.Save()
End Sub
You'll also want this in your form load:

 Me.TopMost = My.Settings.AlwaysOnTop
 chkAlwaysOnTop.Checked = My.Settings.AlwaysOnTop



Ended up working with Me.TopMost = True

thanks!
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.