Results 1 to 5 of 5

Thread: 2 forms, onClose event...

  1. #1

    Thread Starter
    Hyperactive Member gmatteson's Avatar
    Join Date
    Feb 2002
    Location
    Rhode Island, USA
    Posts
    293

    2 forms, onClose event...

    I have 2 forms, on the close event of the second form, i am trying to make it set the lable on form one blank...

    i have tried...

    dim form1 as new form1()

    form1.label.text = "" but when i close the form it doesn't clear out the lable, is this because this is another instance of the form? if i take out the NEW in the dim statement then i get the error, there is no instance of the object...etc...
    any idea?

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    again the story of passing data between forms. Search this forum for data across two forms or something like that, you will find the answer.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Member
    Join Date
    Jan 2003
    Location
    Beer City
    Posts
    33
    Hello, I agree there are prolly hunerds of links for this but, here goes


    on form 1:

    Public Shared newtitle As String

    Private Sub Form1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
    Me.Text = newtitle
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim frm_form2 As New Form2()
    frm_form2.Show()
    End Sub


    on form 2:




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Form1.newtitle = Me.TextBox1.Text
    Me.Close()
    End Sub


    Hope that helps


    tal McMahon
    its called the "F1" key-- use it

  4. #4

    Thread Starter
    Hyperactive Member gmatteson's Avatar
    Join Date
    Feb 2002
    Location
    Rhode Island, USA
    Posts
    293

    Sorry

    Sorry, I didn't realize it was called "passing data between forms" because I'm not actually passing data as in a variable, just calling something.. i appologize

  5. #5
    Member
    Join Date
    Jan 2003
    Location
    Beer City
    Posts
    33
    No need for an apology, Par for the course with .nets help. lots of answers....but whats the damn question to ask...


    tal mcmahon
    its called the "F1" key-- use it

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