Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to cancel eventArgs

how to cancel eventArgs

Scheduled Pinned Locked Moved C#
tutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr Kode
    wrote on last edited by
    #1

    i have the following code this code runs on LogIn form Acts as standby while other forms still opened if(Application.OpenForms["MainForm"].MdiChildren.Length>0) { MessageBox.Show("!..you should close all opened windows before continue", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Application.Exit(); } when code running LogIn form disappeared and user can access any opened form i want to only keep LogIn form running untill entering valid password

    L 1 Reply Last reply
    0
    • M Mr Kode

      i have the following code this code runs on LogIn form Acts as standby while other forms still opened if(Application.OpenForms["MainForm"].MdiChildren.Length>0) { MessageBox.Show("!..you should close all opened windows before continue", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Application.Exit(); } when code running LogIn form disappeared and user can access any opened form i want to only keep LogIn form running untill entering valid password

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Dont use "Application.Exit();" It will kill all forms and end your application. Just close your MainForm and don't close your LoginForm.

      F 1 Reply Last reply
      0
      • L Lost User

        Dont use "Application.Exit();" It will kill all forms and end your application. Just close your MainForm and don't close your LoginForm.

        F Offline
        F Offline
        freakyit
        wrote on last edited by
        #3

        hi, only show your MainForm after a valid passord entered! is a much easier way.. and to cancel the OnClosing use CancelEventAgruments.Cancel = true bless

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups