Link to home
Start Free TrialLog in
Avatar of JohnModig
JohnModig

asked on

Translation of C# array to VB.NET

Hi there.
I need some help translating the following small snippet from C# to VB.NET. Unfortunately I am totaly lost when it comes to C# and this time it is the array that is confusing.

Probably easy for you guys, but hard for me. ;)

Thanks in advance!
//Purchase list (catalog purchases)
if(PRP_CatalogPurchases != null)
{
   for(int i = 0;i < PRP_CatalogPurchases.Count;i++)
   {
   string[] Purchase = (string[])PRP_CatalogPurchases[i];
   PRP_XmlData += "<catalog_purchase>" + Environment.NewLine;
   PRP_XmlData += "<line_number>" +  PRP_htmlspecialchars((string)Purchase[0]) + "</line_number>" + Environment.NewLine;
   PRP_XmlData += "<id>" +  PRP_htmlspecialchars((string)Purchase[1]) + "</id>" + Environment.NewLine;
   PRP_XmlData += "<quantity>" +  PRP_htmlspecialchars((string)Purchase[2]) + "</quantity>" + Environment.NewLine;
   PRP_XmlData += "</catalog_purchase>" + Environment.NewLine;
   }
}

Open in new window

Avatar of Jorge Sanchez
Jorge Sanchez
Flag of Ecuador image

Try:

 
    * 'Purchase list (catalog purchases)
    * If PRP_CatalogPurchases IsNot Nothing Then
    *     For i As Integer = 0 To PRP_CatalogPurchases.Count - 1
    *         Dim Purchase As String() = DirectCast(PRP_CatalogPurchases(i), String())
    *         PRP_XmlData += "<catalog_purchase>" + Environment.NewLine
    *         PRP_XmlData += "<line_number>" + PRP_htmlspecialchars(DirectCast(Purchase(0), String)) + "</line_number>" + Environment.NewLine
    *         PRP_XmlData += "<id>" + PRP_htmlspecialchars(DirectCast(Purchase(1), String)) + "</id>" + Environment.NewLine
    *         PRP_XmlData += "<quantity>" + PRP_htmlspecialchars(DirectCast(Purchase(2), String)) + "</quantity>" + Environment.NewLine
    *         PRP_XmlData += "</catalog_purchase>" + Environment.NewLine
    *     Next
    * End If

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Same tool jorgesv13 :)
Yep, that page rocks! :)
Avatar of JohnModig
JohnModig

ASKER

Oh, that was fast! Thank you guys. For the link as well. ;)