CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 2001
    Posts
    155

    New doesn't work

    I have the following code in an mdi form:\

    private Sub new_Click()
    Dim a as Form1
    set a = new Form1
    a.Caption = "new Script"
    a.show
    End Sub




    And i also have a module with a function:


    Function insertfunc()
    Dim func as string
    Dim ch
    Dim func2 as string
    ch = Chr(10)
    func = InputBox("Enter function name")
    func2 = "function " & func & "()" & ch & "{" & ch & "" & ch & "}"
    insertfunc = func2
    End Function



    Everything works fine. I can create a new form, the function is called without any errors. But when i try to create another new form, it won't create another new one unless the first one is closed. I have the same code in other programs and it works fine. What am i doing wrong? I'll give ratings


    --Ant
    --------------------------------------------------
    check out my newest freeware
    E-mail me at: [email protected]
    for the address

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: New doesn't work

    ' Declared somewhere'
    Dim fFrm as frmYourHugeForm'


    public Sub ShowAForm()'

    set fFrm = new fFrm'
    Load fFrm'
    fFRM.show
    End Sub


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2001
    Posts
    155

    Re: New doesn't work

    It gives me an error that says: User-defined type not defined. What's that mean?

    --Ant
    --------------------------------------------------
    check out my newest freeware
    E-mail me at: [email protected]
    for the address

  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: New doesn't work

    I think that the line

    Dim fFrm as frmYourHugeForm'

    gives you the problem

    Rewrite it as
    Dim fFrm as Form


    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

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

Featured