1 Replies - 12377 Views - Last Post: 16 December 2007 - 07:41 PM Rate Topic: -----

#1 kaymaf  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 24
  • Joined: 03-October 07

Convert VB6 to VB.net

Posted 16 December 2007 - 05:39 PM

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

  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	 


Is This A Good Question/Topic? 0
  • +

Replies To: Convert VB6 to VB.net

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Convert VB6 to VB.net

Posted 16 December 2007 - 07:41 PM

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1