Click here to Skip to main content
13,197,548 members (51,632 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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.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:


Picture1.ScaleWidth / 2

any idea for translate these codes..?
Posted 23-Apr-13 7:28am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


There are plenty of free online converters.[^][^]

ProgramFOX 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 <small>-- line 1 col 8: invalid NonModuleDeclaration</small>.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

ThePhantomUpvoter 24-Apr-13 13:48pm
How does that help the OP translate VB6 code to C#?
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171020.1 | Last Updated 27 Apr 2013
Copyright © CodeProject, 1999-2017
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