Results 1 to 8 of 8

Thread: Retrieve parameters

  1. #1

    Thread Starter
    New Member
    Join Date
    May 1999
    Location
    Cordoba, Argentina
    Posts
    15

    Question

    I need to build an application that receive a parámeter like a option that return data. How i declare this parameter in the first form or module and the variable returned ?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Question ???

    Can not get what you mean.

  3. #3
    Hyperactive Member
    Join Date
    Dec 1999
    Posts
    321

    Question Huh

    Explain your problem, and I may be able to help you.
    Signed, Rodik ([email protected])
    Programmer,usesVB6ED
    ===========================
    Copyright©RodikCo,2002.

    Dont mind this signature ;] Its old

  4. #4
    Lively Member
    Join Date
    Jun 2000
    Posts
    82
    If you mean you want to save a setting when you finish with the programme, and retrieve it later, you can use the commands GetSetting and SaveSetting. These use the registry to save any setting you want and retrieve it later.

    Say you have a text box called Text1, and you want it to 'remember' what it said the last time the user ran the programme, you would put in the Form_Unload event

    Code:
    SaveSetting("MyApp","Startup","Text",Text1.text)
    and in the Form_Load event,

    Code:
    Text1.text=GetSetting("MyApp","Startup","Text","")

  5. #5

    Thread Starter
    New Member
    Join Date
    May 1999
    Location
    Cordoba, Argentina
    Posts
    15
    Excuse my poor description of problem.
    I want to build an application that receive data from command line and return data to command line, i.e.
    "myapp.exe parameter", and return code of execution (success or no).

  6. #6
    Lively Member
    Join Date
    Jun 2000
    Posts
    82
    To retrieve data from the command line, you use the Command$ operator in the form_load event.

    Code:
    Msgbox "You said " & Command$
    I don't know how to return data to the command-line.

  7. #7
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Should be under the Form_Load() Events

    You should get the command line paramter when your program is started and not at the mid way of your program.

    Code:
    'Declare under Basic Module File
    Option Explicit
    Public MyCommandLine As String
    
    Private Sub Form_Load()
    MyCommandLine = Command()
    'Assume your program will only loaded when the command line string is /%2
    If MyCommandLine <> "/%2" then End
    End Sub
    or if your program is start from a Sub main module.
    Code:
    Option Explicit
    Public MyCommandLine As String
    
    Public Sub Main ()
    MyCommandLine = Command()
    'Assume your program will only loaded when the command line string is /%2
    If MyCommandLine <> "/%2" then
       End
    Else
       Load frmMain
       frmMain.Show
    End If
    End Sub

  8. #8
    Addicted Member LAURENS's Avatar
    Join Date
    Jan 2000
    Location
    Utrecht, the Netherlands
    Posts
    138
    Retrieving parameters from the commandline has been answered already.
    I don't think you can return a value from a VB prog other than putting some file on disk or write a value to the registry.

    If I'm wrong I would like to know, cause I've always considered this an omission in VB.
    Regards,
    Laurens

    Using VB5 Enterprise edition SP3
    VB6 Enterprise edition SP5

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