Click here to Skip to main content
15,918,404 members
Please Sign up or sign in to vote.
1.86/5 (4 votes)
See more:
Help, How am I gonna convert this project that is in C# to VB.NET
Drawing a Radar Display Using C#[^]
Can somebody can help me with this... I just need it for my project.

This is only the program that is good but it is only available in c#
I do not need a C# to VB.NET Converter, I just need the whole project
to be converter to VB.NET

Thanks,
Posted
Comments
phil.o 26-Oct-11 8:55am    
Why don't you just use the library as is, adding a reference to it in your VB project. You don't have to convert it to VB for that, you can use any .NET dll.
And if it is for learnig purpose, why using a tool ?
Vic91 26-Oct-11 15:11pm    
I think it's easier to convert from C# to VB than the other way around... VB is just more cooperative (so to say). You should probably give a try at converting it yourself so you add to your experience.
sora97 27-Oct-11 10:32am    
OK CONVERTER CODE GOT ERRORS:

ERRORS ON timer = ambigous
ERROD: _radar.imageupdate = cannot called as direct event
RESULT RADAR NOT MOVING...

CONVERTED CODE WITH ERRORS
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Namespace Blaney
Public Partial Class frmMain
Inherits Form
Private _radar As Radar
Private t As New Timer()
Private rnd As New Random()

Public Sub New()
InitializeComponent()
' internal item update timer
t.Interval = 60
' t.Tick += new EventHandler(t_Tick);
t.Enabled = True
End Sub

' RadarItem item1 = new SquareRadarItem(1, 8, 190, 60);
'RadarItem item2 = new CircleRadarItem(2, 8, 45, 45);
'RadarItem item3 = new TriangleRadarItem(3, 8, 30, 30);

Private Function GetDelta() As Integer
Dim i As Integer = rnd.[Next](0, 2)
If i = 0 Then
i -= 1
End If
Return i
End Function

' void t_Tick(object sender, EventArgs e)
' {
' // select which of the three items to update
' int i = rnd.Next(1, 4);
'
' switch (i)
' {
' case 1:
' item1.Azimuth += GetDelta();
' item1.Elevation += GetDelta();
' _radar.AddItem(item1);
' break;
' case 2:
' item2.Azimuth += GetDelta();
' item2.Elevation += GetDelta();
' _radar.AddItem(item2);
' break;
' case 3:
' item3.Azimuth += GetDelta();
' item3.Elevation += GetDelta();
' _radar.AddItem(item3);
' break;
' }
' }
'

Private Sub frmMain_Load(sender As Object, e As EventArgs)
_radar = New Radar(pictureBox1.Width)
pictureBox1.Image = _radar.Image
_radar.ImageUpdate += New ImageUpdateHandler(AddressOf _radar_ImageUpdate)
_radar.DrawScanInterval = 60
_radar.DrawScanLine = True
End Sub

Private Sub _radar_ImageUpdate(sender As Object, e As ImageUpdateEventArgs)
' this event is important to catch!
pictureBox1.Image = e.Image
End Sub

Private Sub pictureBox1_Click(sender As Object, e As EventArgs)

End Sub
End Class
End Namespace

Their are many Tools available on Google to convert C# code to VB.Net. However their is certainly no guaranty of accuracy of these Tools.
Google Search Result

Alternatively you can post your comment on the Article you are referring and inquire if Author can provide you any help on this.
 
Share this answer
 
Comments
Espen Harlinn 26-Oct-11 20:10pm    
5'ed!
RaisKazi 27-Oct-11 0:53am    
Thank you Espen. :)
As suggested there are a number of tools available.
But none of them do a complete job - so you will need to do some of the conversion yoruself as well.
 
Share this answer
 
Comments
Espen Harlinn 26-Oct-11 20:10pm    
Good point :)
Abhinav S 27-Oct-11 1:01am    
Thank you Espen.
As you have probably seen, there are quite a few tools to convert small chunks of code from C# to VB, but I've never seen a complete project converter. I use DeveloperFusion[^] to convert the code. Since it is supposed to be your project, don't you think it would be a good idea if you did do some of it yourself?
 
Share this answer
 
Here is a converter application Telerik JustDecompile[^]

BUT please beaware that the conversion is not 100% so you will need to correct some of the errors, the most common conversion problem I have seen with these applications is that it normally doesn't do the conversion for the custom event handlers properly.
 
Share this answer
 
 
Share this answer
 
Comments
[no name] 28-Mar-14 7:54am    
How is this an any better answer than Solution 2 posted 3 years ago?
CHill60 28-Mar-14 8:45am    
Please do not post solutions to old posts unless they add something new. You will just get repeatedly reported until your solution is eventually deleted
C#
script.Append("$(function() {");
script.AppendFormat("$('#{0}').datepicker(", txt_Date.ClientID);
script.Append("{");
script.AppendFormat(@"showOn: 'button',buttonImage: '{0}',", "App_Themes/Default/CalendarImages/DatePicker.gif");
script.Append(@"buttonImageOnly: true,changeMonth: true,changeYear: true, showAnim: ''});});");
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900