Results 1 to 4 of 4

Thread: A second Form

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Middle of nowhere
    Posts
    45

    Question A second Form

    ok, another stupid question...

    Say i have 2 forms.

    On form1 i have a textbox and a button. How do i make it to where if you insert a the correct string in the textbox, hit the button, it opens up form2 and closes form1?

    as it stands i've been simply having form1 do a .show of form2, and having form1's .visible property turn to False when the string is inputed correctly. is there a better way of doing it?


    ---Flac
    Everything great once started with the words "That will never catch on, you shouldnt even bother" be great, go against the crowed, do something stupid, you might become famous.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    If Form1 is your application startup form , then you can't use Close() method because this will closes the application , you should hide it instead or make visible property =false . As for Form2 , you can close it as long as it's not the application startup form .

    As I understood , you did it right .

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2004
    Location
    Middle of nowhere
    Posts
    45
    Ok. Now if i keep doing it the way i currently am. How would i close form1 when i want the program to end?

    When i do the "end" process on form2 will it end form1 as well? or do i need to make code to make form1.visible = true again and then close that?

    If the "end" process doesnt end form1 from form2, is there a way i can make a process from form2 to end form1?

    if this seems a little like blindsided questioning, please excuse me, currently not on a computer with VB.net so i cant experiment and test it myself.

    thanks for the info thus-far

    ---Flac
    Everything great once started with the words "That will never catch on, you shouldnt even bother" be great, go against the crowed, do something stupid, you might become famous.

  4. #4
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Flac
    Ok. Now if i keep doing it the way i currently am. How would i close form1 when i want the program to end?

    When i do the "end" process on form2 will it end form1 as well? or do i need to make code to make form1.visible = true again and then close that?

    If the "end" process doesnt end form1 from form2, is there a way i can make a process from form2 to end form1?

    if this seems a little like blindsided questioning, please excuse me, currently not on a computer with VB.net so i cant experiment and test it myself.

    thanks for the info thus-far

    ---Flac
    You can always close the application from anywhere and any form by calling :
    Application.Exit()
    You don't have to show the form first and then close , GC(Garbage Collector) takes care of this and clean the memory and reclaime it .

    or
    Me.Close()
    When you are in the main form , But , I prefer the first method as it forces the application to close down in cases it refuse ....

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