Neil Clarke

array length in array initialiser is different from C# to VB.NET

object[] namevalues = new object[2 * parms.Length]; in C#

Converts to:

Dim namevalues As Object() = New Object(2 * parms.Length - 1) {} in VB.NET

Note the -1 in the array length
Problem by Neil Clarke Status: Not Done Comments: 1 Last update: 2015-06-08T16:18:49 by Neil Clarke
0
Sam Lewis

Incorrect conversion for implemented interfaces

The c# to vb converter does not add the "Implements Interface.Mehod" after the implemented method for example:
When implementing IXmlSerializable the "Implements IXmlSerializable.GetSchema" was not added after the "Public Sub ReadXml(reader As System.Xml.XmlReader)"
Problem by Sam Lewis Status: Not Done Comments: 0 Last update: 2015-06-08T15:03:33 by Sam Lewis
0
Nicholas De La Haye

Bug no number truncation from C# to VB .net

Tried to convert some code from C# to VB .net using your online converter but it translated the code wrong and does truncate the number down.

It tried to translate this C# code:-
return (int)(Sample()*maxValue);

And turned into this VB code:-
Return CInt(Sample() * maxValue)

The problem is the CInt function in VB does not truncate a number down, so if you had a value of 9.98 the CInt function would will return 10. But the C# cast of (int) only rounds down so should return 9 not 10. CInt is mainly used to convert text to a number. You need to use Floor or Fix functions to address this issue.

Please can you fix this bug?
Problem by Nicholas De La Haye Status: Not Done Comments: 0 Last update: 2015-05-30T19:43:31 by Nicholas De La Haye
0
Dmitry Barsukov

Bug in conversion of For cycle

C# original:
List<string> values = new List<string>(value.Split(' '));
// Filter empty
for (int i = 0; i < values.Count; ++i)
if (values[i].Trim().Length == 0)
{
values.RemoveAt(i);
--i;
}

VB.NET conversion:
Dim values As New List(Of String)(value.Split(" "C))
' Filter empty
For i As Integer = 0 To values.Count - 1
If values(i).Trim().Length = 0 Then
values.RemoveAt(i)
i -= 1
End If
Next
----------------------------------------
This is not correct: VB.NET does not check values.Count on every iteration. That why conversion is not correct
Problem by Dmitry Barsukov Status: Not Done Comments: 0 Last update: 2015-05-11T12:58:10 by Dmitry Barsukov
0
Amit Valentine

Method with no Attribute

When I tried to convert from VB.net to C# an problem occurred that I had to solve by typing.
Vb.net Allows you to call methods without parenthesis .
Like
SomeString.Trim is correct for VB.net but in C# it must be SomeString.Trim()
This converter does not add those brackets.
I hope Telerik will have a look on this problem.
And thanks for this awesome converter.
Problem by Amit Valentine Status: Not Done Comments: 0 Last update: 2015-04-17T21:42:16 by Amit Valentine
0
David Marcus

Incorrect conversion for String.Split and indexing of results

I have VB code:
Dim featureData() As String = Split(item, ":")
FeatureId = CInt(featureData(0))

The converted to C# code:
string[] featureData = Strings.Split(item, ":");
FeatureId = Convert.ToInt32(featureData(0));

Notes:

1) For the String.Split it should have used
string[] featureData = item.Split(':');

2) it generated bad code (syntax error) for the second line, should be
FeatureId = Convert.ToInt32(featureData[0]);

Note the incorrect use of parenthesis which should have been braces (for the subscript reference).

Better yet, it could have used int.Parse(featureData[0]);
Feedback by David Marcus Status: Not Done Comments: 0 Last update: 2015-04-07T16:51:14 by David Marcus
0
garima sah

vb to javascipt

Feedback by garima sah Status: Not Done Comments: 0 Attachments: 1 Last update: 2015-04-03T10:04:17 by garima sah
0
Víctor Lara Santillán

Concatenating strings

When using c# I used:
string test = "1";
test = "1" + "2"; // test should be 12;

In VB translation it gives:
test = "1" + "2";

this should be:
test = "1" & "2";
Feedback by Víctor Lara Santillán Status: Not Done Comments: 0 Last update: 2015-02-18T14:51:21 by Víctor Lara Santillán
0
Serkan Güncan

cursor , ico

Bitmap bmp = new Bitmap("sineklik.png");
ico == Icon.FromHandle(bmp.GetHicon); ---> why does it make mistakes?
customCursor = new Cursor(ico.Handle);
this.UseWaitCursor = false;
this.Cursor = customCursor;
Problem by Serkan Güncan Status: Not Done Comments: 0 Last update: 2015-02-16T12:44:41 by Serkan Güncan
0
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
0
Displaying items 31 - 40 of 71