CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 1999
    Location
    India, West Bengal
    Posts
    36

    Spawning new windows

    I want to open up new windows from a procedure in VB and based on a parameter I pass to each window.
    Based on this parameter each window will show same form but data will slightly differ based on calculation with the passing parameter.

    And I want to be able to open n number of windows where n is a not too big variable.
    How can I do this ?

    Thankx in advance to all




  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Spawning new windows

    You can use a Visual Basic designed form as if it were a class.
    Thus, for example, we have a form which displays a customer address. In the form there is a public property defined thus:


    'from frmAddress
    public property let AddressId(byval lId as Long)

    me.txtID.Text = CStr(lId)
    'fill othyer fields by looking up address...
    End property




    Now to load a number of these, from an array of ids do the following.


    Dim lIndex as Long
    Dim frmThis as frmAddress

    for lIndex = LBound(ArrIds) to UBound(ArrIds)
    set frmThis = new frmAddress
    frmThis.AddressId = ArrIds(lIndex)
    frmThis.Show
    next lIndex




    HTH,
    D.

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

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