473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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.

Nov 20 '05 #1
3 2448
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

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

"Dr. Zharkov" <va************@mtu-net.ru> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... 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.

Nov 20 '05 #2
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 wrote:
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 On**********@BTInternet.Com
Nov 20 '05 #3
Dim g as Graphics = Me.CreateGraphics

Sorry, Cut and Paste Type .

Regards - OHM

One Handed Man wrote:
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 wrote:
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 On**********@BTInternet.Com


Best Regards - OHMBest Regards - OHM On**********@BTInternet.Com
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Steve | last post by:
Hi, I'm getting some output by running a command using os.popen. I need to parse the output and transform it in some sense so that it's 'DB compatible', (i.e I need to store the output in a...
0
by: Sue Adams | last post by:
I actually have two issues/questions: I have an autonumber field in an access db table that I grab and later use to update a record in another table withing the same db. The code I use to get...
4
by: AndrewM | last post by:
Hello, I have a SUB which has input variables. If I run it once its okay, but I need to include it in a for....next loop. Can this be done ? for i=0 to 100 call mySub(arr(0,i)) next
5
by: Fawke101 | last post by:
Hi There, I have a table with 3 rows. 1st has the table/column headers, 2nd contains the column data and the 3rd is where the loop for the SQL statement lies. I also have a JS sort function on...
1
by: Will | last post by:
I have the following code: var rx = /{{(.+?)}}/i; var expr = 'each {{word}} wrapped in {{curly}} {{braces}} in this {{string}} needs to be {{replaced}} with a different {{value}}.'; var values...
8
by: Steve Edwards | last post by:
Hi, While iterating through a multimap, I need to replace elements that meet certain conditions with a new element. There doesm't seem to be a replace() function for multimaps, so I'm inserting...
16
by: Claudio Grondi | last post by:
Sometimes it is known in advance, that the time spent in a loop will be in order of minutes or even hours, so it makes sense to optimize each element in the loop to make it run faster. One of...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
8
by: SaltyBoat | last post by:
Needing to import and parse data from a large PDF file into an Access 2002 table: I start by converted the PDF file to a html file. Then I read this html text file, line by line, into a table...
2
by: erikcw | last post by:
Hi all, I'm trying to write a loop that will build a list of "template strings". My current implementation is *really slow*. It took 15 minutes to finish. (final len(list) was about 16k...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.