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
[quoted text, click to view] "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
>