Results 1 to 6 of 6

Thread: [RESOLVED] 2005 no form.Close() event??

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    60

    Resolved [RESOLVED] 2005 no form.Close() event??

    I'm working with 2005 today and need to put some code inside the closed() event of my form. But it isn't there in 2005?? The Closed(), Closing() events are not present in 2005 in the designer.

    How do I execute some code while a form is closing or immediately thereafter in 2005??

    Thanks.
    Last edited by sooner; Mar 1st, 2007 at 01:23 PM.

  2. #2
    Hyperactive Member
    Join Date
    May 2005
    Posts
    258

    Re: [2005] no form.Close() event??

    Closed() changed to FormClosed(). FormClosing() and FormClosed() are the new names.
    Currently Using: VS 2005 Professional

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] no form.Close() event??

    Look under the "(FormName Events)" dropdown on the left side of the code behind window.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] no form.Close() event??

    Quote Originally Posted by RobDog888
    Look under the "(FormName Events)" dropdown on the left side of the code behind window.
    You're showing your VB heritage Rob. Those drop-down lists are not available in C#.

    The Closing and Closed events still exist for compatibility but they are now obsolete. As tacoman667 suggested, the FormClosing and FormClosed events have been added and should be used in their stead. The differences that I'm aware of are that the new events get raised if you call Application.Exit whereas the old ones don't. The new events also provide a reason for the close. This makes doing things like minimising to the system tray instead of closing much easier because it's dead easy to test whether your form is closing because Windows is shutting down.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [2005] no form.Close() event??

    So right you are John. I've run into this more then once as I switch back and forth from .NET and VB 6 each and every day lol.


    on the spot. )
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Re: [2005] no form.Close() event??

    ignore. wrong reply

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width