Results 1 to 3 of 3

Thread: Ref Mainform to 2nd form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Location
    South Africa
    Posts
    88

    Question Ref Mainform to 2nd form

    Hi ..

    I am trying to open a 2nd form with a reference to the mainform
    Code...

    Dim frm As New Form2(Me)
    frm.Show()

    A wigly shows under (Me) with error message
    Too many arguments to 'Public Sub New()'.
    High hopes go to all that looks down!!!

  2. #2
    Registered User
    Join Date
    Nov 2002
    Location
    Växjö, Sweden
    Posts
    314
    Add an argumet to the second forms Sub New method. Something like this.

    Dim mainForm as Form

    Sub New(mForm as Form)
    MyBase.New()
    mainFom = mForm
    InitializeComponent()
    End Sub

    Now you should be able to pass the Me object to the form and have the reference to it in the variable mainForm.
    Last edited by Athley; Nov 28th, 2002 at 07:43 AM.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2002
    Location
    South Africa
    Posts
    88
    Thanks a million, much appreciated
    High hopes go to all that looks down!!!

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