-
[Q] Compile Error? Process is member of the namespace...
Hello ^^ I met a problem while learnning Visual Basic.NET
It's a simple program.
But this source isn't compiled by vbc.exe into .NET Framework SDK
C:\vbc Module1.vb (Enter->)
source : Module1.vb
--------------------------------------------------------------------------------------------------
Imports System
Module Module1
Sub Main()
Try
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
System.Diagnostics.Process.Start(args(0))
Catch e As InvalidOperationException
Console.WriteLine("Please input the program name to run")
Console.WriteLine(e)
End Try
End Sub
End Module
--------------------------------------------------------------------------------------------------
result :
--------------------------------------------------------------------------------------------------
Microsoft (R) Visual Basic .NET Compiler version 7.00.9372.1
for Microsoft (R) .NET Framework version 1.00.3328.4
Copyright (C) Microsoft Corporation 1987-2001. All rights reserved.
C:\Documents and Settings\Administrator\My Documents\Module1.vb(11) : error
BC30456: 'Process' is not a member of 'Diagnostics'.
System.Diagnostics.Process.Start(args(0))
--------------------------------------------------------------------------------------------------
This source doesn't trouble me at VB.NET RC0 release.
The program built at VS.NET behaves properly.
What's the difference the two?
Do you know that? ^^
-
Re: [Q] Compile Error? Process is member of the namespace...
Dennis,
>What's the difference the two?
When you create a project in VS.NET, it adds references to a number of
commonly used assemblies for you.
When you build from the command line, you have to explicitly reference
those assemblies yourself
vbc /r:System.dll Module1.vb
Mattias
===
Mattias Sjögren (VB MVP)
mattias @ mvps.org
http://www.msjogren.net/dotnet/
-
Re: [Q] Compile Error? Process is member of the namespace...
Thank you Mattias!
I succeeded in solving the problem.
But practically speaking, I didn't get the desired result.
what I want, ...see below ...
--------------------------------------------------------------------------------------------------
c:\Module1.exe hello.exe (Enter->)
c:\hello,world
--------------------------------------------------------------------------------------------------
Now, My Module1.exe can't print hello,world...
hum~~~~ What's the wrong?
I wish Module1 print hello,world
hello.... world..... -_-;
source : Module1.vb
--------------------------------------------------------------------------------------------------
Imports System
Module Module1
Sub Main()
Try
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
System.Diagnostics.Process.Start(args(0))
Catch e As InvalidOperationException
Console.WriteLine("Please input the program name to run")
Console.WriteLine(e)
End Try
End Sub
End Module
--------------------------------------------------------------------------------------------------
-
Re: [Q] Compile Error? Process is member of the namespace...
>I succeeded in solving the problem.
Good.
>But practically speaking, I didn't get the desired result.
Sorry, but I still don't understand exactly what you're trying to do.
>c:\Module1.exe hello.exe (Enter->)
What's hello.exe?
>c:\hello,world
And what do you mean by this?
If you want an array of command line arguments in your code, you can
simply type
Sub Main(ByVal CmdArgs() As String)
You don't have to use Command() and String.Split() unless you really
want to.
Mattias
===
Mattias Sjögren (VB MVP)
-
Re: [Q] Compile Error? Process is member of the namespace...
Hello, Mattias? ^^
Module1.exe is a simple launcher program for the other.
hello.exe is ...
#include<stdio.h>
int main()
{
printf("hello,world");
return 0;
}
or
Imports System
Module Hello
Sub Main()
Console.WriteLine("hello,world")
End Sub
End Moudule
It's a famous & simple program.
I think I can understand my purpose using it.
Present Mudule1.exe can launch any program.
ex) C:\Program window\Winzip\Module1.exe winzip32.exe 'launch winzip
But can't print the result of target program(like hello.exe) on command window.
-
Re: [Q] Compile Error? Process is member of the namespace...
...I can understand ... -> you can understand
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks