Advertisement
TheVideoVolcano

How to make a 'Don't show again form in vb.net'

Jun 19th, 2013
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.17 KB | None | 0 0
  1. '***Edit better to use Reg Keys!
  2. ' make bools = true, instead of "not" because they might already be true and will make them false by doing that.
  3.  
  4.  
  5. 'This will load [loginFORM.vb] before the main form unless you check the checkbox in [loginFORM.vb] telling it not too ever again
  6. 'This has no flicker of the main form, it is very smooth.
  7.  
  8.  
  9. '--------------In form 1-----------------
  10.  
  11. '►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄TO DO:►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►◄►
  12.  
  13. '► Create a Boolean setting and make sure it's initial value is false which is automatic.
  14. '► Make form1 property setting 'ShowInTaskBar' to 'FALSE' and form1 property setting 'WindowState' to 'MINIMIZED'
  15. '► Make another form to be the login and create checkbox on that form, in my example I call it [loginFORM.vb]
  16.  
  17.  
  18.  
  19. '► ---------------------Put the follow somewhere inside the code of [form1.vb]--------------------------
  20.  
  21. Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
  22.  
  23.         If Not My.Settings.showlogin Then
  24.             Login.Show()
  25.             Me.Hide()
  26.         End If
  27.     End Sub
  28.  
  29. '---------------------------------------------------------------------------------------------------
  30.  
  31.  
  32.  
  33.  
  34.  
  35. '► ---------------------Put the follow somewhere inside the code of [LoginFORM.vb]--------------------------
  36.  
  37.   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  38.         If CheckBox1.CheckState = CheckState.Checked Then
  39.             My.Settings.showlogin = Not My.Settings.showlogin
  40.          
  41.         End If
  42.         Form1.ShowInTaskbar = True
  43.         Form1.Show()
  44.         Form1.WindowState = FormWindowState.Normal
  45.         Me.Hide()
  46.     End Sub
  47.  
  48.     Private Sub Login_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  49.         End
  50.     End Sub
  51.  
  52. '---------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement