473,569 Members | 2,762 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Catch argments by running an .exe

Hi,

If anyone who knows how to catch the argments within
a .NET executable file? i.e. run "MyProgram. exe arg1 arg2"
and how to read arg1 and arg2 in VB.NET?

Thanks in advance
Nov 20 '05 #1
1 1256
Hello,

"Li Pang" <li*****@eu.alt ria.com> schrieb:
If anyone who knows how to catch the argments within
a .NET executable file? i.e. run "MyProgram. exe arg1 arg2"
and how to read arg1 and arg2 in VB.NET?


\\\
Public Sub Main(ByVal astrCmdLineArgs () As String)
Dim i As Integer
For i = 0 To astrCmdLineArgs .Length - 1
Console.WriteLi ne(astrCmdLineA rgs(i))
Next i
End Sub
///

-- or --

\\\
Public Sub Main()
Dim i As Integer
For i = 0 To Environment.Get CommandLineArgs ().Length - 1
Console.WriteLi ne(Environment. GetCommandLineA rgs(i))
Next i
End Sub
///

--
Herfried K. Wagner
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2887
by: Steve | last post by:
I have some general catch clauses in my app as follows: try { } catch(Exception ex) { } try
11
3466
by: Pohihihi | last post by:
I was wondering what is the ill effect of using try catch in the code, both nested and simple big one. e.g. try { \\ whole app code goes here } catch (Exception ee) {}
3
1838
by: will | last post by:
Hi all. I've got an question about how to catch an exception. In Page_Load, I place a DataGrid, dg1, into edit mode. This will call the method called GenericGridEvent. GenericGridEvent will call a mehtod called ExceptionGenerator that will generate a run-time exception. The exception is caught in GenericGridEvent, but it isn't caught in...
6
4151
by: ECathell | last post by:
I am having a problem with my try..catch blocks... I push a button on my form. using SQLDMO I verify the status of the server. If it is off I turn it on. I then run a query that requires a service restart. I stop the SQL Agent I stop the SQL Server which throws an error.
4
15903
by: Strah | last post by:
Is there a way to catch the event of terminating the application from the the processes tab in task manager? I have created windows app, and if a user termintates the app in the task manager, I'd like to be notified. I tried few combinations of Close, Closing, Application.Exit method, ApplicationExit Event, etc, but nothing seems to be...
3
1408
by: ThunderMusic | last post by:
Hi, I use remoting in a Windows app... this remoting call a ServerA and using ServerA get an object (marshaled) from ServerB... if I call a method on the object gotten from ServerB and this ServerB has shut down it's service, I get an exception and this exception stop the application event if it's inside a try-catch structure... I mean, it...
5
3103
by: not_a_commie | last post by:
Using a synchronized Queue, I did some testing on catching the "queue was empty on dequeue" exception vs. doing my own lock, checking for empty, and then dequeuing. The try/catch method, though simpler in code, was 100x slower than doing my own empty-check before dequeue. That seems incredible to me that the try/catch handlers could be that...
12
2664
by: David Lozzi | last post by:
Howdy, I ran into a very interesting issue and I'm curios as to how this is suppose to work. I am using Try...Catch...Finally statements for all database connectivity in my ASP.NET 2.0 web application. I'm connecting to IBM's Universe 10.2 using UniObjects.Net. Anyway, if the connection errors, the Finally closes the connection. What I see...
5
14310
by: kellygreer1 | last post by:
I think I'm not quite understanding something about error handling in PHP5. I have written some PHP code to index the contents of C drive on a Windows machine. When it gets to certain special folders (fake folders) it runs into errors. Directories it can not read from. I have tried wrapping the code in a Try / Catch and the error still...
0
7609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.