Colleagues,
(Just in case: Win10, VS 2019, .NET 5.0)
I have a set of commonly used UDFs ("User Defined Function", if someone don't know) in a separate project (as Console Application). I develop and code these functions and subs there, and then copy-paste them into my other project on As-Needed bases.
Needless to say that I need to test these functions and subs before using them in my other projects. E.g. if I have, say, Function Between(ByVal tArg, ByVal t1st, ByVal t2nd) As Boolean, I'd like to test it like
and do it in that same project!
So, I added Sub Main() like this:
set it as Startup object in Project's Properties ... and immediately got an error message "Statement is not valid in a namespace."
Alrite, I "encapsulated" it with Class/End Class, like this:
and then got the error in subject line.
What am I doing wrong?
Please advise!
Regards,
Ilya
(Just in case: Win10, VS 2019, .NET 5.0)
I have a set of commonly used UDFs ("User Defined Function", if someone don't know) in a separate project (as Console Application). I develop and code these functions and subs there, and then copy-paste them into my other project on As-Needed bases.
Needless to say that I need to test these functions and subs before using them in my other projects. E.g. if I have, say, Function Between(ByVal tArg, ByVal t1st, ByVal t2nd) As Boolean, I'd like to test it like
Code:
MsgBox(Between(2022, 2000, 2035))
and do it in that same project!
So, I added Sub Main() like this:
Code:
Imports System
Imports System.Net
Imports System.String
Imports System.IO
Imports System.Xml
Imports System.Threading
Imports System.Net.Mail
Imports System.Windows
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.FileIO
'====================================================================================================================================
Sub Main()
'====================================================================================================================================
End Sub
'====================================================================================================================================
'====================================================================================================================================
Public Class Common_Functions
...
set it as Startup object in Project's Properties ... and immediately got an error message "Statement is not valid in a namespace."
Alrite, I "encapsulated" it with Class/End Class, like this:
Code:
Imports System
Imports System.Net
Imports System.String
Imports System.IO
Imports System.Xml
Imports System.Threading
Imports System.Net.Mail
Imports System.Windows
Imports Microsoft.VisualBasic
Imports Microsoft.VisualBasic.FileIO
Public Class Func_Tester
'====================================================================================================================================
Sub Main()
'====================================================================================================================================
End Sub
'====================================================================================================================================
End Class
'====================================================================================================================================
Public Class Common_Functions
'====================================================================================================================================
...
What am I doing wrong?
Please advise!
Regards,
Ilya