|
-
Dec 28th, 2002, 07:37 AM
#1
Thread Starter
Lively Member
System.io.filenotfoundexception
Code
Module Module1
Sub Main(ByVal CmdArgs() As String)
Dim ArgNum As Integer
For ArgNum = 0 To UBound(CmdArgs)
Console.WriteLine("Argument " & ArgNum.ToString() & ": " & CmdArgs(ArgNum).ToString())
Next ArgNum
End Sub
End Module
This is the err i got when i tried to run a console application in vb.net with the above code
An unhandled exception of type 'System.io.filenotfoundexception' occured in unknown module
Pls help me..
-
Dec 29th, 2002, 04:16 AM
#2
Fanatic Member
did you declare "console"? which kind of object is this?
You try to writeline to "console" when console isn't declared or iitialised you'd get this kind of error.
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
-
Jan 3rd, 2003, 01:03 AM
#3
Thread Starter
Lively Member
I am using a console application only. the problem is with the statement
Function Main(ByVal CmdArgs() As String) As Integer
where it displays the err...
No accessible, parameterless 'Sub main()' was found in the application.. this is the exact err.. when i bypass and run, it raises the exception 'filenotfound'.. pls give me a soln..
-
Jan 3rd, 2003, 03:45 AM
#4
Fanatic Member
your project doesn't find a startup object. You need to have a startup-form or a sub main (in a module). a function main doesn't work. If you wrote your sub main, change the startup proprty of your project (do not know where to find it, cause i do not have VB.NET installed on the computer that i'm working on)
- Use the thread tools to Mark your Thread as Resolved when your question is answered.
- Please Rate my answers if they where helpful.
-
Jan 3rd, 2003, 04:18 AM
#5
Registered User
In a console application you should have a Sub New (This is a requirement) that is not taking any arguments as the main procedure. Then call the procedure to get your arguments.
Code:
Module Module1
Sub Main()
MySub(MyArray)
End sub
Sub MySub(ByVal CmdArgs() As String)
Dim ArgNum As Integer
For ArgNum = 0 To UBound(CmdArgs)
Console.WriteLine("Argument " & ArgNum.ToString() & ": " & CmdArgs(ArgNum).ToString())
Next ArgNum
End Sub
End Module
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
|
Click Here to Expand Forum to Full Width
|