Windows Forms App as Console App

B

Barry

Hi

I want to start a Visual Basic Windows Form app from the console by
specifying parameters (this is possible in C#), is i add the following
method i get a error

Public Sub Main(ByVal args As String())
Console.Write(args.Length)
End Sub

the above method works in a console app.

can someone help in this regard


TIA
Barry
 
A

Alex Meleta

Hi Barry,

What error do you get and where?
Anyway, do you want to use console app to start any other app (winforms or
such)? If so, then use:

[c#] System.Diagnostics.Process.Start("some.exe", string.Join(" ", args))


Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com



B> Hi
B>
B> I want to start a Visual Basic Windows Form app from the console by
B> specifying parameters (this is possible in C#), is i add the
B> following method i get a error
B>
B> Public Sub Main(ByVal args As String())
B> Console.Write(args.Length)
B> End Sub
B> the above method works in a console app.
B>
B> can someone help in this regard
B>
B> TIA
B> Barry
 
P

Patrice

See :
System.Environment.GetCommandLineArgs

Seeing command line arguments as arguments for the main function is a C like
language "tradition".



You may want to elaborate a bit as I'm not sure to understand what you are
trying to do (of couse Console.Write won"t work in a Windows applciation).
My understanding ois that you want to launch a Windows application and
reading possible command line arguments passed when starting this Windows
application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top