Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB C#4.0
Hi ,
i want to know how can i change code from vb to c#?
here is my code:
Public Declare Function SetCapture Lib "user32.dll" (ByVal hWnd As Long) As Long
 
Public Declare Function ReleaseCapture Lib "user32.dll" () As Long
Private Sub Form1_Load()
    Dim retval As Long  ' return value
    retval = SetCapture(Picture1.hWnd)
    Picture1.ScaleMode = 3
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)  
 
    Static oldX As Long, oldY As Long  ' the previous mouse coordinates
    Picture1.Line (Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2)-(oldX, oldY), _
        Picture1.BackColor
    Picture1.Line (Picture1.ScaleWidth / 2, Picture1.ScaleHeight / 2)-(X, Y)
     oldX = X: oldY = Y
 
End Sub
Private Sub Picture1_Click()
 
      Dim retval As Long 
    retval = ReleaseCapture()
 
End Sub
 
i cant translate these code to c# like:
ScaleMode
Picture1.Line
Picture1.ScaleWidth / 2
 
any idea for translate these codes..?
tnx
GL
Posted 23-Apr-13 8:28am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hello,
 
There are plenty of free online converters.
 
http://www.developerfusion.com/tools/convert/vb-to-csharp/[^]
 
http://converter.telerik.com/[^]
 
Valery.
  Permalink  
Comments
ProgramFOX at 24-Apr-13 13:03pm
   
The code of the OP is VB code, not VB.NET. If I try to convert his code to C# using these translators, then I get -- line 1 col 8: invalid NonModuleDeclaration.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
Comments
ThePhantomUpvoter at 24-Apr-13 13:48pm
   
How does that help the OP translate VB6 code to C#?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 Mathew Soji 195
4 BillWoodruff 170
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,777
2 DamithSL 5,461
3 Manas Bhardwaj 4,916
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100