Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 149,934 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,635 people online right now. Registration is fast and FREE... Join Now!




Convert VB6 to VB.net

 
Reply to this topicStart new topic

Convert VB6 to VB.net

kaymaf
16 Dec, 2007 - 04:39 PM
Post #1

New D.I.C Head
*

Joined: 3 Oct, 2007
Posts: 24


My Contributions
can someone help me convert the code below from vb6 to vb.net

CODE
  Const intUpperBoundX = 200
Const intUpperBoundY = 200
Dim Pixels(1 To intUpperBoundX, 1 To intUpperBoundY) As Long
Private Sub Command1_Click()
    Dim x, y, intAddOn As Integer
    Dim bytRed, bytGreen, bytBlue, bytAverage As Integer
    
    intAddOn = Val(Text1.Text)
    
    For x = 1 To intUpperBoundX
        For y = 1 To intUpperBoundY
            Pixels(x, y) = Picture1.Point(x, y)
        Next y
    Next x
    
    For x = 1 To intUpperBoundX
        For y = 1 To intUpperBoundY
            bytRed = Pixels(x, y) And &HFF
            bytGreen = ((Pixels(x, y) And &HFF00) / &H100) Mod &H100
            bytBlue = ((Pixels(x, y) And &HFF0000) / &H10000) Mod &H100
            
            bytRed = bytRed + intAddOn
            If bytRed > 255 Then bytRed = 255
            bytGreen = bytGreen + intAddOn
            If bytGreen > 255 Then bytGreen = 255
            bytBlue = bytBlue + intAddOn
            If bytBlue > 255 Then bytBlue = 255
            
            Pixels(x, y) = RGB(bytRed, bytGreen, bytBlue)
         Next y
    Next x
    
    
    For x = 1 To intUpperBoundX
        For y = 1 To intUpperBoundY
            Picture2.PSet (x, y), Pixels(x, y)
        Next y
    Next x
    
End Sub    

User is offlineProfile CardPM
+Quote Post

Jayman
RE: Convert VB6 To VB.net
16 Dec, 2007 - 06:41 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,317



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Did you try just opening the VB6 project in VS.NET? It will automatically perform the necessary conversion.

Although, it rarely does a 100% conversion, but it will get you most of the way there.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:39PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month