Conversion vb6 to VB 2008 Express

  • Thread starter George W. Barrowcliff
  • Start date

G

George W. Barrowcliff

I have an application developed by someone else using VB6 that needs a few
changes. Last guy is gone, so is VB6 environment.
I downloaded and installed 2008 Express, then converted application.

I have lots of errors (95) and 102 Warnings. I have cleared some of the
errors (down to 74) but some conversions I just don't get and need some help
in understanding the conversion.

Thanks to anyone that takes a look and points me somewhere.

GWB


i.e.
'Recordset' is not a member of 'System.Windows.Forms.Label'
'DataBaseName' is not a member of 'System.Windows.Forms.Label'
'ctlRefresh' is not a member of 'AxMSGBGrid.AxDBGrid'

These are repeated often and I cannot see why the wizard thinks that
Recordset should be a member of System.Windows.Forms.Label

Original

Private Sub pgrid_size()
Dim T_RS As Recordset
Set T_RS = db.OpenRecordset(tn, dbOpenDynaset)
Set pData.Recordset = T_RS
pgrid.Refresh
pgrid.Columns(0).Width = 700
pgrid.Columns(1).Width = 3500
pgrid.Columns(2).Width = 1500
pgrid.Columns(3).Width = 1500
pgrid.Columns(0).Caption = "Dr/Cr"
pgrid.Columns(1).Caption = "Account Name "
pgrid.Columns(2).Caption = "Debit(Rs.)"
pgrid.Columns(3).Caption = "Credit(Rs.)"
pgrid.RowHeight = 250
End Sub

After Conversion
Private Sub pgrid_size()

'UPGRADE_WARNING: Arrays in structure T_RS may need to be initialized before
they can be used. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="814DF224-76BD-4BB4-BFFB-EA359CB9FC48"'

Dim T_RS As dao.Recordset

T_RS = db.OpenRecordset(tn, dao.RecordsetTypeEnum.dbOpenDynaset)

'UPGRADE_ISSUE: Data property pData.Recordset was not upgraded. Click for
more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="076C26E5-B7A9-4E77-B69C-B4448DF39E58"'

pData.Recordset = T_RS

'UPGRADE_NOTE: Refresh was upgraded to CtlRefresh. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="A9E4979A-37FA-4718-9994-97DD76ED70A7"'

pgrid.CtlRefresh()

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Width. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(0).Width = 700

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Width. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(1).Width = 3500

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Width. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(2).Width = 1500

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Width. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(3).Width = 1500

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Caption. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(0).Caption = "Dr/Cr"

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Caption. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(1).Caption = "Account Name "

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Caption. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(2).Caption = "Debit(Rs.)"

'UPGRADE_WARNING: Couldn't resolve default property of object
pgrid.Columns().Caption. Click for more:
'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'

pgrid.get_Columns(3).Caption = "Credit(Rs.)"

pgrid.RowHeight = 250

End Sub
 
Ad

Advertisements

S

Scott M.

The fact is that "converting" VB 6 code to VB .NET is often not worth the
trouble. VB .NET is not just the new version of VB, it's an entirely new
language running on an entirely new Framework.

As such, many of the objects you used in your old code no longer exist in VB
..NET and you will have to rewrite the applicaiton if you want to take
advantage of those new objects.

There is no Recordset in .NET. You'll need to come up to the new .NET data
objects, known collectively as ADO .NET.

-Scott
 
A

Armin Zingler

George said:
I have an application developed by someone else using VB6 that needs a few
changes. Last guy is gone, so is VB6 environment.
I downloaded and installed 2008 Express, then converted application.

I have lots of errors (95) and 102 Warnings. I have cleared some of the
errors (down to 74) but some conversions I just don't get and need some help
in understanding the conversion.
In addition to Scott (I agree with him): The application must be
compilable in VB6 on the machine that you use to convert it. Otherwise
the preconditions to convert it are not met. (if it wouldn't even run in
VB6, how could it in VB.Net?)
IMO, one should know both languages well to do the conversion.
 
Z

zp18

<Snip!>


Is the alternative going back to VB6? I'm OK with that since at this
time
only a few minor changes are needed. I thought that the Express VB
product
would do the job but I have spent a ton of time in trying to get this
converted.

Since the VB6 environment is gone also, cd's, books, etc. I will need
to
find a copy somewhere on the used market if it exists.

Thanks for your quick answer.

GWB
 
N

Nobody

zp18 said:
Since the VB6 environment is gone also, cd's, books, etc. I will need
to
find a copy somewhere on the used market if it exists.
VB6 is still available to MSDN Subscribers. Visual Studio 6, including VC6
are not.
 
K

Kevin Provance

| Is the alternative going back to VB6? I'm OK with that since at this
| time
| only a few minor changes are needed. I thought that the Express VB
| product
| would do the job but I have spent a ton of time in trying to get this
| converted.
|
| Since the VB6 environment is gone also, cd's, books, etc. I will need
| to
| find a copy somewhere on the used market if it exists.
|

Yes, going back to VB6 would be your best bet. It's still a very viable
language without all the silly .Nxt BS that is really irrelevant. I could
probably hook you up with a free copy.
 
Ad

Advertisements

A

Alex Clark

Wow,

So let's see - we've had racism, sexism, inappropriate language, jealousy at
others' superior knowledge to your own, and now you're advocating software
piracy of a Microsoft product on a Microsoft newsgroup?
 
M

Mike Williams

Last guy is gone, so is VB6 environment. I downloaded
and installed 2008 Express, then converted application. I have lots of
errors (95) and 102 Warnings.
You've been conned, George. Micro$oft have conned you by deliberately
leading you to believe that VB.Net is the next version of Visual Basic, when
it is not. It is a lie, George. A deliberate Micro$oft lie. VB6 is the last
and final version of Visual Basic. You'll need to rewrite your application
so you might as well rewrite it in something that is not from such an
untrustworthy company as Micro$oft. Try Delphi.

Mike
 
A

Armin Zingler

Armin said:
In addition to Scott (I agree with him): The application must be
compilable in VB6 on the machine that you use to convert it. Otherwise
the preconditions to convert it are not met. (if it wouldn't even run in
VB6, how could it in VB.Net?)
IMO, one should know both languages well to do the conversion.
BTW, some trolls are visitting this group from time to time, frustrated
about not being able or willing to understand and keep up with the
brilliant achievements of newer versions of a product. You can safely
ignore them. :)
 
C

Cor Ligthert[MVP]

George,

Despite what others say, if you want at the end a program that is 10 times
faster then VB6 (what is possible with VB for Net), then converting is no
option.

However, If you have a straight written program, that not as most VB6
programs, because the lack of all the new classes now available in Net, is
written with all kind of calls to Win32 Apis or other from today's scope
seen obscure methods. Then you can try a convert.

Have a look at this page for your current problem.
http://support.microsoft.com/kb/315974

Be aware that it is not an easy job and if you are ready, you will ask
yourself why you did not do it all new like the others wrote, but in my idea
is it worth to try, all was it only because the experience you get from that
about VB for Net.

(You can do it also direct in Net, but you are than not gone through that
learning path which others here who write so easily to start direct with
Net).

95 errors is not much for an converting job because it is not impossible
that most are all the same and are just telling that a DLL is not available.

Just my idea,

Cor
 
M

Mike Williams

Despite what others say, if you want at the end a
program that is 10 times faster then VB6 (what is
possible with VB for Net) . . .
Put your money where your mouth is fatty. And change that picture on your
MVP profile. You look like a child molester with his head on upside down.
 
Ad

Advertisements

F

Family Tree Mike

George said:
I have an application developed by someone else using VB6 that needs a few
changes. Last guy is gone, so is VB6 environment.
I downloaded and installed 2008 Express, then converted application.
If you want to upgrade your code to VB.net, then it will be easier to
learn and recode with VB Express from scatch, keeping the look and
algorithms from previous code.

If you want to go with VB 6, please move the question there as there
(Microsoft.Public.VB.General.Discussion). Many of the posts in this
thread from VB 6 zealots, though unproductive in this group, may be from
posters with reasonable advice when asked in the vb6 group.
 
C

C

If you want to upgrade your code to VB.net, then it will be easier to
learn and recode with VB Express from scatch, keeping the look and
algorithms from previous code.
I am in a similar situation, except that the decision is made: VB.net
will be used in future.

Over the last 14 years, thousands of lines of VB3-6 code has been
written, almost all of which is in use. I wonder how long it could
take to recode and not convert all of that. I cannot work full time as
a programmer. On the other hand, most of my VB6 code is relatively
simple - no databases, no communications with other programs or too
many APIs. There is just graphics, mostly plots of 4 kinds. Is
recoding a feasible option? Any estimate on how many weeks, months or
years it could take me? I wonder how many months it will take me to
learn "enough" of VB.net.
 
S

Scott M.

I own and operate an IT training company and am faced with this question all
the time. The fact is that VB 6 developers coming to .NET very often have a
harder time, in some respects, than people who have no prior programming
experience.

This is because of the incorrect impression that VB .NET is just VB 6, with
new features. That's not the case at all. As I mentioned in an earler post
VB .NET is a new language that runs on a completely different runtime than
VB 6.0. But, because (on the surface) VB 6 can look similiar to VB .NET,
many folks get the incorrect perception that they know enough VB 6.0 to just
jump into VB .NET and get stuff done (and done correctly!). This is false.

You should move to .NET because it's already got 8 years of a track record
as the successor to VB 6 and because it is much more in line with other
modern OO languages. Those who tell you that VB 6 still has its place for
new application development, are just plain misinformed and/or uneducated
about what .NET is all about.

I can't tell you how long it would take you to "convert" your VB 6 apps.,
becuase, in many cases, a complete rewrite would be necessary, in order to
reap the full benefits of .NET.

Take it from someone who has made the transition as well as teaches others
how to make the transition, start learning .NET with your eyes wide open and
don't assume that you know how somthing should be done or how something
works because of your VB 6 experience. I can say that after 6 months of
learning and practicing with VB .NET, you should begin to "get it" in terms
of how .NET differs from VB 6 (and other forms of classic Windows and
Internet) programming.

Just a couple of quick examples:

This method declaration works in both VB 6 and in VB .NET, but it works
differently in .NET than in VB 6:

Public Sub Foo(x As String)

In VB 6, when you didn't specify how a parameter should be passed, it was
passed ByRef by default. In .NET, all parameters are passed ByVal by
default. Not knowing that simple change could dramatically affect your
code.

Here's another one:

If x = 7 And y = 8 Then...

In VB 6, you may be surprised to find, that even if x is not 7, the VB 6
runtime would still evaluate the y = 8 portion of the If statement. And, it
will do that as well in VB .NET! But, VB .NET adds the AndAlso keyword to
make the statement only need to look at the first portion of the test and if
it is false, then the second portion will be skipped.

When you convert something like this to VB .NET, the converter won't change
your And to AndAlso and the code will compile and run, but it won't be
taking advantage of the performance gain of AndAlso.

These are just two simple examples of code that *works* in both VB 6 and VB
..NET, but if you don't understand the inner workings of VB .NET, you'll not
be taking adavantage of all the language has to offer and you'll have
converted for no good reason.

Take the time to learn .NET from the ground up and you'll never go back to
VB 6 again.

-Scott


If you want to upgrade your code to VB.net, then it will be easier to
learn and recode with VB Express from scatch, keeping the look and
algorithms from previous code.
I am in a similar situation, except that the decision is made: VB.net
will be used in future.

Over the last 14 years, thousands of lines of VB3-6 code has been
written, almost all of which is in use. I wonder how long it could
take to recode and not convert all of that. I cannot work full time as
a programmer. On the other hand, most of my VB6 code is relatively
simple - no databases, no communications with other programs or too
many APIs. There is just graphics, mostly plots of 4 kinds. Is
recoding a feasible option? Any estimate on how many weeks, months or
years it could take me? I wonder how many months it will take me to
learn "enough" of VB.net.
 
J

J.B. Moreno

-snip-
I am in a similar situation, except that the decision is made: VB.net
will be used in future.

Over the last 14 years, thousands of lines of VB3-6 code has been
written, almost all of which is in use. I wonder how long it could
take to recode and not convert all of that. I cannot work full time as
a programmer. On the other hand, most of my VB6 code is relatively
simple - no databases, no communications with other programs or too
many APIs. There is just graphics, mostly plots of 4 kinds. Is
recoding a feasible option? Any estimate on how many weeks, months or
years it could take me? I wonder how many months it will take me to
learn "enough" of VB.net.
Well, my experience has been that upgrading to .Net is not only
feasible, but relatively straightforward. I've done two apps, one with
just a single form, and one with a couple of dozen.

Biggest problem has been third party tools and some database type
conversion issues.

Not having done anything with plots, I can't speak to that.

As for learning "enough" of VB.net it's less "VB" and more ".net" as in
the .Net Framework. While that's a large area, most of it you probably
won't need or need to learn.

I'd say go for it.
 
M

Mike Williams

As I mentioned in an earler post VB .NET is a new
language that runs on a completely different runtime than VB 6.0.
At last, an honest admission of something VB6 programmers have been saying
all along, and something that has been consistently denied by the various
dotnet trolls who from time to time infest the VB6 newsgroup in their
deliberate attempt to destroy it.
But, because (on the surface) VB 6 can look similiar to
VB .NET, many folks get the incorrect perception . . .
Nope. That's not the reason. The real reason people get the wrong impression
is because that's how Micro$oft have dishonestly marketed it. VB.Net was a
lie from the very beginning, and still is a lie.

Mike
 
Ad

Advertisements

C

C

Thanks a lot for this advice. Several respectable people have told me
to learn VB.net, so I have accepted their word and will learn it. I
cannot afford to do it full time, or spend much of my day time doing
that, so it will be slow. Some questions/comments below.

I own and operate an IT training company and am faced with this question all
the time.  The fact is that VB 6 developers coming to .NET very often have a
harder time, in some respects, than people who have no prior programming
experience.
I have realised this. I am not able to unlearn easily even though I
normally learn new things relatively well and fast.
This is because of the incorrect impression that VB .NET is just VB 6, with
new features.  That's not the case at all.  As I mentioned in an earler post
VB .NET is a new language that runs on a completely different runtime than
VB 6.0.  But, because (on the surface) VB 6 can look similiar to VB .NET,
many folks get the incorrect perception that they know enough VB 6.0 to just
jump into VB .NET and get stuff done (and done correctly!).  This is false.
Well, I know VB.net has too many things which are different, and the
OO thinking is different, but all my math code will remain the same.
You should move to .NET because it's already got 8 years of a track record
as the successor to VB 6 and because it is much more in line with other
modern OO languages.  Those who tell you that VB 6 still has its place for
new application development, are just plain misinformed and/or uneducated
about what .NET is all about.
Yes.


I can't tell you how long it would take you to "convert" your VB 6 apps.,
becuase, in many cases, a complete rewrite would be necessary, in order to
reap the full benefits of .NET.

Take it from someone who has made the transition as well as teaches others
how to make the transition, start learning .NET with your eyes wide open and
don't assume that you know how somthing should be done or how something
works because of your VB 6 experience.  I can say that after 6 months of
learning and practicing with VB .NET, you should begin to "get it" in terms
of how .NET differs from VB 6 (and other forms of classic Windows and
Internet) programming.
That would not be too bad.
Take the time to learn .NET from the ground up and you'll never go back to
VB 6 again.
Yes. I am just looking for the right material to read up, as another
post of mine this evening asked for. I found some good msdn material
which I have printed out, but will need a lot more of that.
 
C

C

-snip-



Well, my experience has been that upgrading to .Net is not only
feasible, but relatively straightforward.  I've done two apps, one with
just a single form, and one with a couple of dozen.

Biggest problem has been third party tools and some database type
conversion issues.

Not having done anything with plots, I can't speak to that.

As for learning "enough" of VB.net it's less "VB" and more ".net" as in
the .Net Framework.  While that's a large area, most of it you probably
won't need or need to learn.

I'd say go for it.
I am already able to replace the code for plotting, but I am now
wondering if the whole thing should be redone instead of converting. A
lot of mathematics (subroutines with only calculations; at the most
Text1.Text = temperature) will remain the same.
 
N

Nobody

C said:
Over the last 14 years, thousands of lines of VB3-6 code has been
written, almost all of which is in use. I wonder how long it could
take to recode and not convert all of that.
Some of the options available is KBasic. It's is similar to features to
VB.Net, but 100% VB6 code compatible, according to the author. It's open
source, and written in VC++ 2008. It uses Qt as GUI toolkit, and compiled
code runs on Windows/Linux/Mac. I haven't tried it myself, so you may want
to check it out:

http://www.kbasic.com
http://en.wikipedia.org/wiki/Qt_toolkit
 
Ad

Advertisements

J

J.B. Moreno

-snip-
I am already able to replace the code for plotting, but I am now
wondering if the whole thing should be redone instead of converting. A
lot of mathematics (subroutines with only calculations; at the most
Text1.Text = temperature) will remain the same.
I'd say give it a try and see how it goes -- don't be afraid of a lot
of errors to begin with, try fixing them and see where it goes.
There's probably only going to be a few basic types and fixing the
various instances one of the other (once you've figured it out) is
little more than typing (or even search and replace).

Before doing the conversion, it's recommended that you go through and
do what you can to make the conversion go more smoothly (again this is
mainly a lot of typing), in particular make sure that you've used a
declared type where ever possible and that parameters are declared as
ByVal unless they really need to be ByRef. The best thing about this
is that if you decide to stick with VB6, you've just cleaned up your
code a bit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top