CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Opening forms with parameters

    According to the help file frm.Show does not support named parameters. Is there any way of passing these parameters without resorting to global variables. In Access you can use

    Me.openargs

    to get any parameters. Is there a similar command in VB?

    Thanks

    Andrew


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

    Re: Opening forms with parameters

    If you mean to get the executable program's command line, you can use the Command$

    reserved word.

    HTH,
    D

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

  3. #3
    Join Date
    Aug 2000
    Location
    England
    Posts
    185

    Re: Opening forms with parameters

    What I need is to be able to open a form with a parameter string, i.e the result from a list box which will be used in the child form.

    Thanks for your help

    Andrew


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

    Re: Opening forms with parameters

    In Visual basic you do not need to close one form when another opens. Moreover every loaded form is effectively a global class which can be accessed by other parts of the program.

    For example:

    'in frmMain
    private Sub CommandChild_Click()
    frmChild.Show vbModal
    End Sub

    'in frmChild
    private Sub Form_Load()

    If frmMain.lstValues.Text = "Customer" then
    '\\ customer was selected from listbox
    else
    '\\ something other than customer was selected
    End If
    End Sub





    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