How a loop from VB6 to replace on loop in VB .NET?

D

Dr. Zharkov

Hello. I converted the project from VB6 in VB .NET 2003, however in the
following loop there are errors of a upgrade
(in Help of VB .NET 2003 is not written, how to correct these errors):

For x = Xmin To Xmax
CurrentX = Points(x, Ymin).Trans(1)
CurrentY = Points(x, Ymin).Trans(2)
For y = Ymin + 1 To Ymax
Me.Line(Points(x, y).Trans(1), Points(x, y).Trans(2))
Next y
Next x

The big request: inform, please, how competently to write this loop in VB
..NET?

Beforehand many thanks for the answer, Dr. V.A. Zharkov. Moscow, Russia.
 
K

Ken Tucker [MVP]

Hi,

Try something like this.

Dim g As Graphics = Me.CreateGraphics

For x = Xmin To Xmax
CurrentX = Points(x, Ymin).Trans(1)
CurrentY = Points(x, Ymin).Trans(2)
For y = Ymin + 1 To Ymax
g.DrawLine(Pens.Black, Points(x,y-1).Trans(1),
Points(x,y-1).Trans(2), _

Points(x,y).Trans(1),
Points(x,y).Trans(2))
Next y
Next x


Ken

-----------------------------
 
O

One Handed Man

Dr Zharkov,
I am not particulary familiar with VB6. However, things
are done a little differently with graphics from what I have seen so far.
You need to return a graphics object from the form to begin working with
drawing.

Dim g as Graphics = g = Me.CreateGraphics

Then you can us the methods in g to draw lines etc. Please look this up in
your help. If you dont have help installed then install it. If you do not
have the option to install help, I suggest that you but a non pirate version
of the software and install it.

Regards - OHM

---------------------------

Dr. Zharkov said:
Hello. I converted the project from VB6 in VB .NET 2003, however in
the following loop there are errors of a upgrade
(in Help of VB .NET 2003 is not written, how to correct these errors):

For x = Xmin To Xmax
CurrentX = Points(x, Ymin).Trans(1)
CurrentY = Points(x, Ymin).Trans(2)
For y = Ymin + 1 To Ymax
Me.Line(Points(x, y).Trans(1), Points(x, y).Trans(2))
Next y
Next x

The big request: inform, please, how competently to write this loop
in VB .NET?

Beforehand many thanks for the answer, Dr. V.A. Zharkov. Moscow,
Russia.

Best Regards - OHMBest Regards - OHM (e-mail address removed)
 
O

One Handed Man

Dim g as Graphics = Me.CreateGraphics

Sorry, Cut and Paste Type .

Regards - OHM


Dr Zharkov,
I am not particulary familiar with VB6. However,
things are done a little differently with graphics from what I have
seen so far. You need to return a graphics object from the form to
begin working with drawing.

Dim g as Graphics = g = Me.CreateGraphics

Then you can us the methods in g to draw lines etc. Please look this
up in your help. If you dont have help installed then install it. If
you do not have the option to install help, I suggest that you but a
non pirate version of the software and install it.

Regards - OHM

---------------------------



Best Regards - OHMBest Regards - OHM (e-mail address removed)

Best Regards - OHMBest Regards - OHM (e-mail address removed)
 

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