Results 1 to 10 of 10

Thread: Problems - How to open a new window from a button ?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    2

    Unhappy

    Can someone help me by replying this msg about how to open a new window from a button in a form ?
    I want to open a new form from the existing form i have created from the button of the existing form.
    If I use the method of MDIForm, the form will be created inside the existing form.
    I want the new form to be loaded not inside the existing form.
    pls..... someone help me ?

  2. #2
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Something like this.

    Code:
    Private Sub command1_click()
       'myNewForm is the form that you wish to show.
       myNewForm.Show
    End Sub
    Iain, thats with an i by the way!

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2000
    Posts
    2

    THANX

    thx lain

  4. #4
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ...to make it on the fly

    Private Sub Command1_Click()

    Dim newform As Object
    Set newform = New Form1
    newform.left = 400
    newform.Top = 2000
    newform.Visible = True


    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  5. #5
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Shouldn't you Dim it as a Form ??
    Iain, thats with an i by the way!

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    ?

    yes I suppose so, but object works as well..is there
    a difference?
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  7. #7
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    Yep.

    1. Dim an object as the correct type, in this case a form, and you will be able to see all of the correct properites and methods with VB's type ahead thingy.

    2. If you dim a variable as an object, you get late binding. If you dim it as the correct type, you will get early binding, which is a lot quicker.
    Iain, thats with an i by the way!

  8. #8
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    Ok

    ..thank you...
    I'll adjust my notes......
    I'll adjust my thoughts...
    very good explanation.....
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  9. #9
    Addicted Member
    Join Date
    May 1999
    Posts
    161
    When dimensioning as Form versus Object, are not also allocating memory correctly from the start ? Therefore saving memory space and probably execution speed...

    A little like declaring a variable as Double versus Variant. The compiler knows immediately how much memory to reserve.

    Is that right ?

  10. #10
    Fanatic Member
    Join Date
    Mar 2000
    Location
    That posh bit of England known as Buckinghamshire
    Posts
    658
    No. Not with objects. You are right about variant versus othere types, but objects are diferent.

    A Variable that is defined as an object is not actaully the object itself. It is just a 32 bit pointer to the object. As is a variable declared as a form. It is not the form, it is just a pointer to where the form is in memory.

    Iain, thats with an i by the way!

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