1 Replies - 502 Views - Last Post: 06 July 2011 - 03:01 PM Rate Topic: -----

#1 prorata.net  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 06-July 11

C# code conversion to VB.NET

Posted 06 July 2011 - 01:44 PM

Hi All,
I am converting a C# Web Application to VB.NET. The problem occurs with the line "Array.Sort". I am unable to find a VB.NET equivalent of this line.


ArrayList arrSymbologies = new ArrayList();

// get all public static properties
PropertyInfo[] propertyInfos;
propertyInfos = typeof(BarCodeReadType).GetProperties(BindingFlags .Public |
BindingFlags.Static);
// sort properties by name
[b]Array.Sort(
propertyInfos, delegate(PropertyInfo propertyInfo1, PropertyInfo propertyInfo2) 
{ return propertyInfo1.Name.CompareTo(propertyInfo2.Name); }[/b]
);


​I tried different online (free) C# to VB.NET converters, they convert is as follows, but the Visual studio 2008 give errors (BC30201: Expression expected. ; BC32017: Comma, ')', or a valid expression continuation expected.)

Array.Sort(propertyInfos, Function(propertyInfo1 As PropertyInfo, propertyInfo2 As PropertyInfo) propertyInfo1.Name.CompareTo(propertyInfo2.Name))


Please help in this regard.
Thanks in Advamce
Babar

This post has been edited by prorata.net: 06 July 2011 - 01:46 PM


Is This A Good Question/Topic? 0
  • +

Replies To: C# code conversion to VB.NET

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 458
  • View blog
  • Posts: 4,220
  • Joined: 25-March 09

Re: C# code conversion to VB.NET

Posted 06 July 2011 - 03:01 PM

check this out:
http://www.developer...t/csharp-to-vb/

you may need to add the whole function in it since it may show you errors other wise

EDIT: and you probably check this :D
check this tutorial about delegates in vb.net
http://www.developer...gates-in-vbnet/

This post has been edited by NoBrain: 06 July 2011 - 03:05 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1