Results 1 to 2 of 2

Thread: Multiple Forms

  1. #1

    Thread Starter
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195

    Multiple Forms

    Hello All,

    Kinda new at this!

    How do I reference a form that it already open?

    This is what Im doing:

    I have form3 open, a button on form3 opens form4.

    Then the data I enter in a textbox on form4 I would like it to appear on form3 which is currently open.

    I tried Dim form as form3
    but I get a NullReference Exception!


    Any help would be Appreciated!

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    ok , in Form3 ( to load Form4 ) do this :
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim frm4 As New Form4()
    3.         AddOwnedForm(frm4) '/// make form4 owned by form3.
    4.         frm4.Show()
    5.     End Sub

    in Form4 ( to send some text back to Form3 ) do this :
    VB Code:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         Dim frm3 As Form3 = Me.Owner
    3.         frm3.TextBox1.Text = "some text from form4!"
    4.     End Sub
    to make it easier i've thrown an example together.
    Attached Files Attached Files
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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