Steve Florence

C# event handlers not converting correctly - problem still exists

Converting this simple code, the converter incorrectly converts this:
cbo.Validating += new CancelEventHandler(cbo_Validating);
as this
cbo.Validating += New CancelEventHandler(cbo_Validating)
All it did was to remove the ";"

It should have returned the VB code as:
AddHandler cbo.Validating, AddressOf Me.cbo_Validating

The odd part is that sometimes this converter gets it right.

Snippet trying to convert:
void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
if (e.Control.GetType() == typeof(DataGridViewComboBoxEditingControl))
DataGridViewComboBoxEditingControl cbo = e.Control as DataGridViewComboBoxEditingControl;
cbo.DropDownStyle = ComboBoxStyle.DropDown;
cbo.Validating += new CancelEventHandler(cbo_Validating);
Feedback by Steve Florence Status: Not Done Comments: 0 Last update: 2015-02-03T19:14:19 by Steve Florence
Steve Florence

eventhandler code conversion error

C# Input:
this.Layout += new System.Windows.Forms.LayoutEventHandler(this.ComboBoxTree_Layout);

VB.NET Ouput:
Me.Layout += New System.Windows.Forms.LayoutEventHandler(Me.ComboBoxTree_Layout)

VB.NET ouput should be:
AddHandler Layout, AddressOf Me.ComboBoxTree_Layout
Feedback by Steve Florence Status: Not Done Comments: 0 Last update: 2015-01-16T17:19:48 by Steve Florence
Joe Farrell

Implicit variable type changes from C# to VB.NET

C# Input:
var x = 5 / 3;

Actual VB.NET Output:
Dim x = 5 / 3

Suggested VB.NET Output:
Dim x = 5 \ 3

The C# code declares an int whose value is 1. The VB.NET code currently generated by the converter declares a double whose value is 1.6666667.
Feedback by Joe Farrell Status: Not Done Comments: 2 Last update: 2015-01-13T17:51:37 by Joe Farrell
Steve Florence

lambda expression

When will this converter have the ability to convert lambda code?
Tried this:

protected override void OnStart(string[] args)
EventLogger.Write("Starting service!");
ThreadPool.QueueUserWorkItem( _ => {
new VirtualServerInit(EventLogger).Run();
EventLogger.Write("VirtualServerInit code was executed");

and it failed
Feedback by Steve Florence Status: Not Done Comments: 0 Last update: 2015-01-07T17:25:04 by Steve Florence
David Perish

c# using statement with initializer won't convert, but VB to C# will work

This code will convert from VB to C#, but not vise-versa:

// C#
using (Obj x = new Obj {a == 1,b == 2}) {

' VB.Net
Using x As New Obj With { a = 1, b = 2}
End Using
Problem by David Perish Status: Not Done Comments: 0 Last update: 2014-12-19T15:31:03 by David Perish
JumpMan Jones


Add web-service so that conversion of code can be done without having to hit the website. It would be cool to have a plugin within visual studio that also converted code .
Idea by JumpMan Jones Status: Not Done Comments: 0 Last update: 2014-12-16T20:03:10 by JumpMan Jones
David Sherwood

vb to c# converted a declaration with dynamic instead of var

The Vb code was:
Dim mIncludedItems = aItems.Where(Function(x) pSelectionFilterers.All(Function(y) y.IsFilteredIncluded(x)))
and the C# code was:
dynamic mIncludedItems = aItems.Where(x => pSelectionFilterers.All(y => y.IsFilteredIncluded(x)));

"dynamic" should be "var"
Feedback by David Sherwood Status: Not Done Comments: 1 Last update: 2014-12-08T14:59:49 by Matthieu Penant
Frank Lenoir

Conversion error From, Order By and Select clauses

The following C# code converts incorrect to VB

This C# code:
public string[] CustomPropertyNames
return (from p in _customProps orderby p.Key ascending select p.Key).ToArray();

converts to:
Public ReadOnly Property CustomPropertyNames() As String()
Return (From p In _customPropsOrder By p.Key Ascendingp.Key).ToArray()
End Get
End Property

The result should be:
Public ReadOnly Property CustomPropertyNames() As String()
Return (From p In _customProps Order By p.Key Ascending Select p.Key).ToArray()
End Get
End Property

Frank Lenoir
Problem by Frank Lenoir Status: Not Done Comments: 0 Last update: 2014-11-20T10:48:04 by Frank Lenoir
Richard Oberholz

Fix the output window so it displays larger than 1 inch by 1 inch for IE 11

See attach .jpg image.
Problem by Richard Oberholz Status: Not Done Comments: 0 Attachments: 1 Last update: 2014-10-28T18:25:46 by Richard Oberholz
Donald Record

Small Change Needed

I went to convert the following line from VB to C#:

"oReader = oCommand.ExecuteReader"

(oReader is a System.Data.SqlClient.SqlDataReader)
(oCommand is a System.Data.SqlClient.SqlCommand)

The Code Converter gave me this in C#:

"oReader == oCommand.ExecuteReader"
1. gives me the == comparison operator, which should be "=".
2. Does not give "()" at the end.
3. No ";", not a big deal.

This is the correct C#:
"oReader = oCommand.ExecuteReader();"

Thank you, I am just trying to help.
Problem by Donald Record Status: Not Done Comments: 0 Last update: 2014-10-23T02:19:57 by Donald Record
Displaying items 41 - 50 of 71