Results 1 to 24 of 24

Thread: load event

  1. #1

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Question load event

    Is it possible to close a window on the load event?

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: load event

    Yes.

  3. #3

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    wonderful!
    how?

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Is the 'window', another application?




    Bruce.

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: load event

    Me.Close()

  6. #6

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    mendhak, that has no effect.

    bruce fox, i have a window form and on its 'load' event i want to close it.

  7. #7

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Question Re: load event

    can somebody help me here pls?

  8. #8
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: load event

    huh? what is the purpose of running your program and then close it when it loads?

    or am i missing something?

  9. #9
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Quote Originally Posted by dani2
    i have a window form and on its 'load' event i want to close it.
    the Me.Close() that Mendhak mentioned should do it.

    Have you instantiated the Form from a Module?

    In any event, please post the FormX Load Event code.




    Bruce.

  10. #10

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    I have a test on the 'load' event. If it fails there's no point to display it.
    Can I close it?? because Me.Close() does nothing

  11. #11
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Quote Originally Posted by mar_zim
    huh? what is the purpose of running your program and then close it when it loads?

    or am i missing something?
    I can think of one example (I use it). When an app is opened, validate it for registration. If not valid display a dialog, and unload the Form.




    Bruce.

  12. #12
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Quote Originally Posted by dani2
    I have a test on the 'load' event. If it fails there's no point to display it.
    Can I close it?? because Me.Close() does nothing

    See my second post above (Post the Load Event code)




    Bruce.

  13. #13

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    Ok. i found out why Me.close() is not working..
    The 'Me' its a dialog
    Now, is there any other way to close this dialog on its load event?

  14. #14
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: load event

    Quote Originally Posted by Bruce Fox
    I can think of one example (I use it). When an app is opened, validate it for registration. If not valid display a dialog, and unload the Form.




    Bruce.
    oh...he's talking about validation thingy. my bad.
    sorry.

  15. #15
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Is the 'Dialog' a Form you created, or is it the standard windows MsgBox/MessageBox?




    Bruce.

  16. #16
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Quote Originally Posted by mar_zim
    oh...he's talking about validation thingy. my bad.
    sorry.
    I'm sure alot of people would have thought that after the first read

    The original question implied it too, I just supected that he/she had some idea what they wanted .




    Bruce.

  17. #17

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    It is a form created that inherits
    VB Code:
    1. System.Windows.Forms.Form
    I open it with
    VB Code:
    1. ShowDialog()
    And i want to close it before it displays anything

  18. #18

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    and yes, i do have some idea of what i want!

  19. #19
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    I may help if you post the code used to display that 'Dialog' Form.

    And, the code in it's Load Event.




    Bruce.

  20. #20

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    Really its very common code.
    I open the form from another like this:
    VB Code:
    1. Dim dlgAbsences As EmployeeAbsences
    2.  
    3.         dlgAbsences = New EmployeeAbsences()
    4.         dlgAbsences.ShowDialog()
    and in the load event its a simple test which returns true or false. if it's false i don't want to display the form.
    Me.Close() is ignored..

  21. #21
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    Assuming that there is a reason you don't validate prior to loading the 'Dialog'; I'm at a loss as to why the .Close() dosn't work.

    I dont have .Net on this PC, so I can;t test - sorry.



    Bruce.

  22. #22

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: load event

    No problem. i will make the test prior as you suggested.
    thank you

  23. #23
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: load event

    I just pulled the ol laptop out and did a test.

    It was sucessfull using a 'windows' (2nd) Form.

    I suspect that it is because you inherited the Form.

    Just a guess tho




    Bruce.

  24. #24
    Addicted Member
    Join Date
    Apr 2005
    Location
    Croatia
    Posts
    183

    Re: load event

    Is the window you want to close a form or what?

    try formX.ActiveForm.close()

    where formX is name of your form.

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