How to tell whether a source code is written in Visual Basic or VB.Net?
I have never used Visual Basic before.
I have some source code for a project to look at. How can I tell whether the code has been written in VB or VB.Net?
Thanks.
I had a second look, it does not have any VB6 or VB.Net extension, but it has some ASP files, 1 CSS file and some .XLST extension files with HTML and what seems to be either VB or maybe VBScript i开发者_开发知识库nside.. I am not entirely sure whether it is VB or VBScript inside.
If the project file has the extension .VBP then it is VB6. If you have a .VBPROJ file then it is VB.NET
If you don't have a project file, then the best indicators are Import
directives or object oriented programming keywords like Inherits
or Implements
Files created from Visual Basic 6.0 will have a .bas extension. Files created from Visual Studio .NET and up will have a .vb extention. This isn't a perfect test, but it might get you close.
There's no definitive answer here because there is a large margin of compatibility between the languages. For example the following is legal in both VB.Net and VB6
Function Add(ByVal x, ByVal y)
Add = x + y
End Function
That being said, any of the following wound be a strong indicator of VB.Net code
Import
directivesSyncLock
,Using
statementsFriend
,Protected
access modifierByRef
parameter modifier
And the following would be a strong indicator of VB6
Global
access modfifier
One thing you can look for is a <filename>.vbproj
file. If you see that then you've got a Visual Studio VB.Net project. If the file is missing that doesn't necessarily mean its VB6 though.
If you see <filename>.frm
files then you've got VB6 code.
精彩评论