Results 1 to 7 of 7

Thread: Passing parameter to a VB6 Application

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    2

    Passing parameter to a VB6 Application

    I want to pass a parameter to the VB executable file, and depending upon that parameter a particular form will open. Please guide

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Passing parameter to a VB6 Application

    You are looking for comman line arguments. In VB the command line arguments that are passed from the command line are stored in Command$ string. Here is a simple example
    VB Code:
    1. Public Sub Main()
    2.     If Command$ = "Form1" Then
    3.         Form1.Show
    4.     ElseIf Command$ = "Form2" Then
    5.         Form2.Show
    6.     End If
    7. End Sub
    I am assuming that the startup object will be SubMain and there are already two Forms present in project.
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Passing parameter to a VB6 Application

    @Anik_sinha
    Welcome on the forums

    @Shuja Ali

    what is the use of pasing parameter

  4. #4
    VB Guru ganeshmoorthy's Avatar
    Join Date
    Dec 2005
    Location
    Sharjah, United Arab Emirates
    Posts
    3,031

    Re: Passing parameter to a VB6 Application

    Its like using switches in some application....for example with the pkzip utility you can the -t switch to test the zip files and something else...same like with excel.exe, notepad.exe, winword.exe if you type the file name with full path the application will be opened with the specified file name
    if you type Excel.Exe C:\SomeDir\SomeFile.xls in the Run window excel will open excel with the specified file....
    If an answer to your question has been helpful, then please, Rate it!

    Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.


  5. #5
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Passing parameter to a VB6 Application

    thanks

  6. #6
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Passing parameter to a VB6 Application

    Here is a nice tutorial on Command Line Arguments.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  7. #7
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Re: Passing parameter to a VB6 Application

    good example by ipranks

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