RE: Can someone translate this to vb.net?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



The other conversion will not work - array declarations use the upper bound
in VB, while C# uses length (these are always 1-off).

(the following is produced by Instant VB):
Shared Sub Main(ByVal args As String())
Try
Dim requestPins As WebReference.ZWBRAND_REQUESTEDPINS_LN() = New
WebReference.ZWBRAND_REQUESTEDPINS_LN(0){}

requestPins(0)= New WebReference.ZWBRAND_REQUESTEDPINS_LN()

Dim tandtService As WebReference.ZDC_GET_HISTORYService = New
WebReference.ZDC_GET_HISTORYService()

Dim UserInfo As NetworkCredential= New NetworkCredential("MY USER ID", "MY
PASSWORD")

tandtService.Credentials=UserInfo

'Populate Pin information
requestPins(0).PIN="CH000862116CA"
requestPins(0).FSA=""

'Set-up call and execute service
Dim tandtResponse As WebReference.ZWBRAND_CPCRESPONSE =
tandtService.ZDC_GET_HISTORY("N", requestPins, "1", "JKL", "Y")
'Get a handle on response pin information
Dim responsePins As WebReference.ZWBRAND_PINS_LN() = tandtResponse.PINS
Catch ex As Exception
Console.WriteLine(ex.StackTrace)
End Try
End Sub

--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI


"raz230" wrote:

I'm sorry for posting this here-

I have to integrate an parcel tracking with Canada Post into one of my
applications. The web service they use is made with SAP and is not
the usual WSDL type of service I am used to. I cannot just add a web
reference to my project and get going.

Canada Post provides a sample in Java and C# - and I do not know
either.

If it's not too hard, is anyone able to translate this into VB.net?

static void Main(string[] args)
{
try
{
WebReference.ZWBRAND_REQUESTEDPINS_LN[] requestPins = new
WebReference.ZWBRAND_REQUESTEDPINS_LN[1];

requestPins[0]= new WebReference.ZWBRAND_REQUESTEDPINS_LN();

WebReference.ZDC_GET_HISTORYService tandtService = new
WebReference.ZDC_GET_HISTORYService();

NetworkCredential UserInfo= new NetworkCredential("MY USER ID", "MY
PASSWORD");

tandtService.Credentials=UserInfo;

//Populate Pin information
requestPins[0].PIN="CH000862116CA";
requestPins[0].FSA="";

//Set-up call and execute service
WebReference.ZWBRAND_CPCRESPONSE tandtResponse =
tandtService.ZDC_GET_HISTORY("N", requestPins, "1", "JKL", "Y");
//Get a handle on response pin information
WebReference.ZWBRAND_PINS_LN[] responsePins =
tandtResponse.PINS;
}
catch (Exception ex)
{
Console.WriteLine(ex.StackTrace);
}
}

Huge thanks and sorry if this is asking alot- I just have no clue
about C#...

Raz


.



Relevant Pages

  • Re: Creating/Using VBA Script to Convert Work 2000 wps to Word 200
    ... ' This file needs to be opened by the <convertername> text converter, ... Dim MyFileSysObject As New FileSystemObject ... Dim MyWorksFiles As Files ... Dim MyWordDirectoryPath As String ...
    (microsoft.public.office.developer.vba)
  • Re: Converting to vb.net 2003
    ... Public Class GlobalMembers ... Public Shared tsize As UInteger ... Dim Len As Byte = &H08 ... 'C++ to VB CONVERTER TODO TASK: Unions are not supported in VB. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Need VB code to batch convert wps
    ... there's an add-in that you can download from my web site. ... appropriate Works converter installed. ... Dim strFileName As String ... Dim fDialog As FileDialog ...
    (microsoft.public.word.conversions)
  • Re: How To Obtain Type for Generic Conversion
    ... > Dim converters As New HashTable ... > converters.Add, New IntegerConverter) ... > predefined Converter or not. ... > this to a single routine, that relies on undocumented behavior (the order ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Converting to vb.net 2003
    ... Public Class GlobalMembers ... Public Shared tsize As UInteger ... Dim Len As Byte = &H08 ... 'C++ to VB CONVERTER TODO TASK: Unions are not supported in VB. ...
    (microsoft.public.dotnet.languages.vb)