Blog Stats
  • Posts - 25
  • Articles - 0
  • Comments - 10
  • Trackbacks - 36

 

VB to C# Conversion

I am looking for a tool that will convert a legacy Visual Basic 6.0 code base to C#, has anyone out there know of anything that will help me in this task.

Any help would be appreciated.


Feedback

# re: VB to C# Conversion

Gravatar Your best bet is probably to get a VB.NET to C# converter, and use the VB Upgrade wizard to get from VB6 to VB.NET 2/1/2005 3:08 PM | derick bailey

# re: VB to C# Conversion

Gravatar There's alot more to this question than one may think...just madesome notes <a href="http://www.geekswithblogs.net/sgreenberger/archive/2005/02/01/21703.aspx">here</a> 2/1/2005 3:54 PM | scott

# re: VB to C# Conversion

Gravatar The upgrade wizard creates fairly ugly code, although some stuff translates fairly well. (GIGO) I've done a couple of projects this way- run the wizard and on a function-by-function basis trash, tweak, or rewrite. As you finish each object just run it through a VB.Net-to-C# convertor.
Since I'm responding a month later- did you end up purchasing a solution? 2/28/2005 10:30 PM | joe levasseur

# re: VB to C# Conversion

Gravatar I ended up refactoring the VB application, much of the code base was very poorly written. Once completed I then ran the conversion tool to produce the VB.Net and then did any further conversion using a VB.Net to C# tool. That gave me a pretty good result, not ideal, and I still ended up further refactoring.

Looking back at the excercise, there where a number of key issues that I had;

1. Preserve the design of the Window Forms
2. Preserve the DB logic

The conversion saved me the effort of having to re-implement the Screen Designs, but ultimatly saved me no effort on the rest of the code. 3/8/2005 8:50 PM | davidl

# re: VB to C# Conversion

Gravatar There is a VB6 to C# conversion.
http://www.netcoole.com/vb6tocs.htm 3/16/2005 3:11 AM | sophia

# re: VB to C# Conversion

Gravatar We have a converter - Instant C# - that provides much more than a "pretty good" result.
3/27/2005 10:23 AM | David Anton

# re: VB to C# Conversion

Gravatar (at www.instantcsharp.com) 3/27/2005 10:24 AM | David Anton

# VB TO VB.NET CONVERTING TOOL

Gravatar if neone knows abt a tool that converts vb codes to vb.net plz let me knw asap. 3/28/2005 1:43 AM | Soumya

# re: VB to C# Conversion

Gravatar Imports System.Math
Public Class Draw
Public G_Obj As Graphics

Public Function DrawPoint(ByVal PictureBoxS As PictureBox, ByVal Brush As System.Drawing.Brush, ByVal X As Single, ByVal Y As Single, ByVal Wid As Single)
Dim G As Graphics = PictureBoxS.CreateGraphics

G_Obj = G
G_Obj.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
If G_Obj Is Nothing Then Exit Function
If G_Obj.IsVisible(X, Y) Then
G_Obj.FillEllipse(Brush, X, Y, Wid, Wid)
End If

End Function
Public Function CircleM1(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer
For teta = 0 To 360
If HasDelay = True Then
For i = 1 To 700000

Next
End If

X = Int(Rad * Cos(teta * 3.14 / 180))
Y = Int(Rad * Sin(teta * 3.14 / 180))
DrawPoint(PictureBoxN, Brush, Xc + X, Yc + Y, Wid)
Next

End Function
Public Function CircleM2(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer

For teta = 0 To 90
If HasDelay = True Then
For i = 1 To 2000000
Next
End If

X = Int(Rad * Cos(teta * 3.14 / 180))
Y = Int(Rad * Sin(teta * 3.14 / 180))
DrawPoint(PictureBoxN, Brush, Xc + X, Yc + Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc + X, Yc - Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc - X, Yc + Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc - X, Yc - Y, Wid)

Next

End Function
Public Function CircleM3(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer


For teta = 0 To 45
If HasDelay = True Then
For i = 1 To 7000000
Next
End If

X = Int(Rad * Cos(teta * 3.14 / 180))
Y = Int(Rad * Sin(teta * 3.14 / 180))
DrawPoint(PictureBoxN, Brush, Xc + X, Yc + Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc + X, Yc - Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc - X, Yc + Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc - X, Yc - Y, Wid)
DrawPoint(PictureBoxN, Brush, Xc + Y, Yc + X, Wid)
DrawPoint(PictureBoxN, Brush, Xc + Y, Yc - X, Wid)
DrawPoint(PictureBoxN, Brush, Xc - Y, Yc + X, Wid)
DrawPoint(PictureBoxN, Brush, Xc - Y, Yc - X, Wid)

Next

End Function
Public Function CircleM4(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer

For X = Xc - Rad To Xc + Rad
If HasDelay = True Then
For i = 1 To 700000
Next
End If
Rad = Int(Pow((Rad * Rad - (X - Xc) * (Y - Yc)), 2))
DrawPoint(PictureBoxN, Brush, X, Yc + Rad, Wid)
DrawPoint(PictureBoxN, Brush, X, Yc - Rad, Wid)
Next

End Function
Public Function CircleM5(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer
Dim Tinc As Integer
Tinc = 180 / (3.14 * Rad)
teta = 0
While teta <= 360
If HasDelay = True Then
For i = 1 To 700000
Next
End If
X = Int(Rad * Cos(teta * 3.14 / 180))
Y = Int(Rad * Sin(teta * 3.14 / 180))
DrawPoint(PictureBoxN, Brush, Xc + X, Yc + Y, Wid)
teta = teta + Tinc
End While


End Function
Public Function CircleM6(ByVal PictureBoxN As PictureBox, ByVal Brush As System.Drawing.Brush, _
ByVal Xc As Integer, ByVal Yc As Integer, ByVal Rad As Integer, ByVal Wid As Integer, ByVal HasDelay As Boolean)

Dim teta As Integer
Dim X, Y As Integer
Dim i As Integer
Dim Tinc As Integer
Tinc = 180 / (3.14 * Rad)
teta = 0
While teta <= 360
If HasDelay = True Then
For i = 1 To 700000
Next
End If
X = Int(Rad * Cos(teta * 3.14 / 180))
Y = Int(Rad * Sin(teta * 3.14 / 180))
DrawPoint(PictureBoxN, Brush, Xc + X, Yc + Y, Wid)
teta = teta + Tinc
End While

End Function
End Class
5/30/2005 8:58 AM | behzad

# re: VB to C# Conversion

Gravatar IMHO the best conversion is manual. Less mistakes , more code understanding 9/12/2006 3:32 AM | Online Pharmacy

# re: VB to C# Conversion

Gravatar Visual Basic Upgrade Companion should do the job for you. 11/23/2007 10:43 AM | SK

# re: VB to C# Conversion

Gravatar Try VBConversions - www.vbconversions.net. it's the best VB.net to C# converter available. 7/20/2008 6:15 PM | Dave

# re: VB to C# Conversion

Gravatar A manual conversion is the best option because you gain a better understanding of the finished code. But, the converter from www.newcode.com seems to return the fewest errors in my experience. 9/22/2008 5:05 AM | nerik

# re: VB to C# Conversion

Gravatar rs = Nothing
con = Nothing
con = New ADODB.Connection
con.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & dbPath & " ;Jet OLEDB:Database Password=654;Persist Security Info=True")
rs = New ADODB.Recordset
rs.Open("Select * from tbluser", con, 3, 3)
'check for correct password
rs.MoveFirst()
Do While Not rs.EOF
If txtUserName.Text = rs("UserName").Value And txtPassword.Text = rs("Password").Value Then
LoginSucceeded = True
MsgBox("Correct!", MsgBoxStyle.Information)
If txtUserName.Text = "Admin" Then
MsgBox("Admin Person has enter!", MsgBoxStyle.Information)
Me.Close()
Exit Sub
Else
MsgBox("Normal User has entered ", MsgBoxStyle.Information)
Me.Close()
Exit Sub
End If

'me.Hide()
'frmScoreCard.Show()
'Exit Sub
End If
rs.MoveNext()
Loop

If rs.EOF Then
MsgBox("Invalid Username/Password", , "Login")
End If

rs = Nothing
con = Nothing

End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
'set the global var to false
'to denote a failed login
rs = Nothing
con = Nothing
LoginSucceeded = False
Me.Close()
End Sub

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dlgOpenFile.Title = "Open File"
dlgOpenFile.InitialDirectory = My.Application.Info.DirectoryPath
dlgOpenFile.FileName = "User_Database.mdb"
dbPath = dlgOpenFile.InitialDirectory
dbPath = dbPath + "\" + dlgOpenFile.FileName
End Sub
End Class 1/13/2009 5:06 AM | sahayam

# re: VB to C# Conversion

Gravatar Coding Of Splash Form

Private i As Integer
Option Explicit

Private Sub Form_KeyPress(Key ASCII As Integer)
Unload Me
End Sub

Private Sub Form_Load()
lblLicenseTo.Caption = "Licensed To : Seth Parsram Parumal New Era High School & College."
lblCompanyProduct = "New Era School's "
lblProductName = "School Management System"
lblPlatform.Caption = "Windows XP"
lblVersion.Caption = "Version : 6.0"
lblCopyright = "Copyright (c) 2003-2004"
lblCompany = "Softech Infosys Pvt.Ltd."
lblloading.Caption = "Loading : .."
lblpercent.Caption = "Completed : "
lblWarning = "Warning : This Product is Licensed To New Era High School Under International Copyright Laws. Unauthorized Performance Is Strictly Punishable"
tmrpro.Interval = 1000
End Sub
8/11/2009 2:41 AM | kanchan

# re: VB to C# Conversion

Gravatar Private Sub cmbstaffid_Click()
If rstaff.BOF = False And rstaff.EOF = False Then
rstaff.MoveFirst
Do While Not rstaff.EOF = True
If Val(cmbstaffid.Text) = rstaff.Fields("StaffID").Value Then
txtename.Text = rstaff.Fields("Name").Value
Call staffdetails
Exit Sub
End If
rstaff.MoveNext
cmddelete.Enabled = True
Loop
End If
End Sub 8/25/2009 7:52 AM | kanchan

Post a comment





 

 

 

Copyright © David Lattimore-Gay