Results 1 to 3 of 3

Thread: Question about forms

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    Question about forms

    my program has two forums. One form is the startup form and it has a button that will open another form and set some variables up. I want to add abutton on the second form that when clicked, it will close itself and then reopen the first form and basically set everything to 0 or null. I'm not sure how to do this, because when the second form is running, the first form is in the ".hide" state. Any ideas?

    John

  2. #2
    Addicted Member garyjohn_2000's Avatar
    Join Date
    Apr 2005
    Location
    Timbaland
    Posts
    243

    Re: Question about forms

    You can do something like this

    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim frm1 as Form1 'Replace Form1 wit ur 1st Form name ;)
    3.         'Close the Main form with
    4.         frm1.close 'We do this w/o an error cuz v kno the form is already loaded. Then
    5.         Dim frmn1 as new Form1
    6.         frmn1.show()
    7. End sub

    p.s. I kno its kinda crude....plz dont quote that

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

    Re: Question about forms

    VB Code:
    1. 'in your first form button click event
    2. dim s as string="blah..blah"
    3. dim i integer=3
    4. dim f as new form2()
    5. f.showdialog()
    6. 'after showdialog now set your variables to 0 or null
    7. s=""
    8. i=0

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