User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 423,304 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,339 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 1827 | Replies: 2 | Solved
Reply
Join Date: Apr 2008
Posts: 14
Reputation: mcgarry101 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mcgarry101 mcgarry101 is offline Offline
Newbie Poster

Command line parameters

  #1  
Apr 22nd, 2008
Hi,

I am fairly new to VB.NET and i'm just wondering if anyone can help with a problem I am having. I am looking to pass some parameters to a vb.net application fwhen I call the app from another program (written in oracle forms). My question relates to how these parameters should be handled.

In my form_load I have a test to see if anything is passed in -

<code>strBalType = My.Application.CommandLineArgs(0) </code>.

My other question is how is this app then called? For example from my command line can I just call c:\test.exe 10, and the string above will have a value of ten? I have tried testing this but I always get an index out of range exception.

Also is there a way, when debugging, I can run the project with these command line parameters being passed in from the IDE? This would save me having to build the project every time.

Hopefully someone can help with this because it has been dricing me crazy!

David.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Posts: 52
Reputation: bwkeller is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
bwkeller bwkeller is offline Offline
Junior Poster in Training

Re: Command line parameters

  #2  
Apr 22nd, 2008
Originally Posted by mcgarry101 View Post
In my form_load I have a test to see if anything is passed in -

<code>strBalType = My.Application.CommandLineArgs(0) </code>.

My other question is how is this app then called? For example from my command line can I just call c:\test.exe 10, and the string above will have a value of ten? I have tried testing this but I always get an index out of range exception.

This should work. I would place it in a test to make sure you are properly passing the arg, such as:
visualbasic Syntax (Toggle Plain Text)
  1. If My.Application.CommandLineArgs.Count > 0 Then
  2. MessageBox.Show(My.Application.CommandLineArgs(0))
  3. Else
  4. MessageBox.Show("No args")
  5. End If
Also is there a way, when debugging, I can run the project with these command line parameters being passed in from the IDE? This would save me having to build the project every time.

Click on My Project in the Solution Explorer, click on the Debug tab and enter the command line arguments in the Command line arguments field.
Reply With Quote  
Join Date: Apr 2008
Posts: 14
Reputation: mcgarry101 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
mcgarry101 mcgarry101 is offline Offline
Newbie Poster

Re: Command line parameters

  #3  
Apr 23rd, 2008
Thanks very much for that!

David.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 11:04 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC