Using one set of souce files for both VB .NET 2002 and VB .NET 2003

  • Thread starter Thread starter Howard Kaikow
  • Start date Start date
H

Howard Kaikow

Is there any (reasonable) way to use a single set of source files for both
VB .NET 2002 and VB .NET 2003.

I'd sure like to do coding changes in only one place, but I seem to need a
separate directory for each VB .NET version.
 
Howard,
There is a utility at Code Project that will convert a VS.NET 2003 solution
back to VS.NET 2002.

http://www.codeproject.com/macro/vsconvert.asp

As long as you stay away from VB.NET 2003 constructs (For Each item As
Integer & bit shift operators) there should be no real problems converting
the project back to VS.NET 2002 when working on it on campus.

The one quirk you will find is that VB.NET 2003 removes the parenthesis on
the constructor when creating new objects with the default constructor,
while VB.NET 2002 wants them there.

' VS.NET 2003 syntax
Dim x as New MainForm

' VS.NET 2002 syntax
Dim x as New MainForm()

Hope this helps
Jay
 
Ah, yes, now I recall, I downloaded that on 7 September.

--
http://www.standards.com/; See Howard Kaikow's web site.
Jay B. Harlow said:
Howard,
There is a utility at Code Project that will convert a VS.NET 2003 solution
back to VS.NET 2002.

http://www.codeproject.com/macro/vsconvert.asp

As long as you stay away from VB.NET 2003 constructs (For Each item As
Integer & bit shift operators) there should be no real problems converting
the project back to VS.NET 2002 when working on it on campus.

The one quirk you will find is that VB.NET 2003 removes the parenthesis on
the constructor when creating new objects with the default constructor,
while VB.NET 2002 wants them there.

' VS.NET 2003 syntax
Dim x as New MainForm

' VS.NET 2002 syntax
Dim x as New MainForm()

Hope this helps
Jay
 
Hi Jay,

Unless it's my VS2002, in which case it doesn't seem to mind Dim x As New
MainForm sans brackets.
??

Does this converter correctly handle resx files, eg for PictureBoxes that
are loaded with images in InitializeComponent? My VS always falls over when I
load an OP's VS2003 Forms with graphics.

Regards,
Fergus
 
* "Howard Kaikow said:
Is there any (reasonable) way to use a single set of source files for both
VB .NET 2002 and VB .NET 2003.

I'd sure like to do coding changes in only one place, but I seem to need a
separate directory for each VB .NET version.

Add the file to the 2nd project (if there are no resX ressources) by
opening the "Add Existing File..." dialog and choosing "Reference" from
the dropdown of the "Add" button. Notice that you must not use VB.NET
2003 syntax in the file in order to use it within the VS.NET 2002
project.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
 
Fergus,
Unless it's my VS2002, in which case it doesn't seem to mind Dim x As New
MainForm sans brackets.
I did not mean to imply any sort of bug by that statement more an
observation of behavior, the auto correct intellisense in 2002 will put the
parenthesis there, while 2003 will remove them. You will wind up with
inconsistent code, albeit it will still compile. Just be mindful when you
modify the line as you may get an array of elements when you meant to have a
single element.
Does this converter correctly handle resx files, eg for PictureBoxes that
are loaded with images in InitializeComponent? My VS always falls over when I
load an OP's VS2003 Forms with graphics.
I rarely use the converter, the page implies that it does. Are you using the
converter & is it failing? Or are you attempt a manual conversion and it is
failing? If you go to the page for the utility it states what all is
changed, it changes something in the base64 encoding of objects, which may
be what you are seeing.

Hope this helps
Jay
 
Hi Jay,

If AutoCorrect is the same as Prettify (Messify) then I don't use it. And
while I like Foo() in C#, I hate it in VB because of the ambiguity and for
being optional which leads to inconsistency - so no () for me! :-).

I've been (failing when) converting by hand because of this Base64 thing.
I've downloaded the converter since asking (thanks for the link) and will try
it out when the next 2003 project comes in. Manual definitely isn't any good
so it is very possibly going to help.

Cheers,
Fergus
 
Fergus,
Yes its the same option as Prettify & Messify, the code reformatter.

Hope this helps
Jay
 
That's what I was planning on doing.
I'm in the midst of shifting to using VB .NET 2003, so I've got lots of
projects to convert.
Fortunately, most of the projects are upgrades from VB 6, so I can always
use the VB 6 code to recreate the VB.NET 2002 critter.
The troublesome ones are those that I created anew in VB .NET.
 
Back
Top