Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. command line

command line

Scheduled Pinned Locked Moved Visual Basic
helptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    Unplugged
    wrote on last edited by
    #1

    Is there anyway that I can pass a variable into a vb program when I call it. I want to do something like vbprogram.exe textfile.txt but I don't know how to receive the variable and stuff in the vb program. :(( I know in C it's argsv. any help would be great. :-D ICXC NIKA

    S J 2 Replies Last reply
    0
    • U Unplugged

      Is there anyway that I can pass a variable into a vb program when I call it. I want to do something like vbprogram.exe textfile.txt but I don't know how to receive the variable and stuff in the vb program. :(( I know in C it's argsv. any help would be great. :-D ICXC NIKA

      S Offline
      S Offline
      sultan_of_6string
      wrote on last edited by
      #2

      The default VB projects normally create Sub Main(), kinda like void main() in C++. Well, just like in C++, there are other "versions" of the main function: Sub Main(ByVal CmdArgs() As String) Function Main() As Integer Function Main(ByVal CmdArgs() As String) As Integer Just replace the default with the one you need.

      1 Reply Last reply
      0
      • U Unplugged

        Is there anyway that I can pass a variable into a vb program when I call it. I want to do something like vbprogram.exe textfile.txt but I don't know how to receive the variable and stuff in the vb program. :(( I know in C it's argsv. any help would be great. :-D ICXC NIKA

        J Offline
        J Offline
        Jeremy Falcon
        wrote on last edited by
        #3

        There's also the Command object. And, you can access it from anywhere in the program. It's a string containing what was passed on the command line after the executable's filename. It's up to you to parse it. Try this...

        MsgBox """" & Command & """"

        Then, compile it into an exe and run it from the command line passing whatever you want. Jeremy Falcon Imputek "The happy people are those who are producing something; the bored people are those who are consuming much and producing nothing." - William Ralph Inge

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups