?
Solved

Conversion of C# code to VB code

Posted on 2014-08-07
3
Medium Priority
?
578 Views
Last Modified: 2014-08-08
Hi everyone,

I'm getting into Google's BigQuery, and am trying to piece together some sample code to do some basic functions.  All sample code I have come across on the .NET side has been C#.  I was hoping to write my applications in VB and most of the code is easily converted, except of two lines:

        ServiceAccountCredential credential = new ServiceAccountCredential(
            new ServiceAccountCredential.Initializer(serviceAccountEmail)
            {
                Scopes = new[] { BigqueryService.Scope.Bigquery }
            }.FromCertificate(certificate));

Open in new window


and

        var service = new BigqueryService(new BaseClientService.Initializer()
        {
            HttpClientInitializer = credential,
            ApplicationName = ApplicationName
        });

Open in new window


I have tried multiple online code converters to no avail.  Any assistance would be greatly appreciated.  

I'm using 4.5 framework for my app if that is important.

Thanks in advance,
Dean
0
Comment
Question by:dthansen
  • 2
3 Comments
 
LVL 36

Accepted Solution

by:
ste5an earned 2000 total points
ID: 40246958
See How to: Declare an Object by Using an Object Initializer (Visual Basic).

E.g.
Dim service As BigqueryService = New BigqueryService(
	New BaseClientService.Initializer() With { 
		.HttpClientInitializer = credential, 
		.ApplicationName = ApplicationName 
		}
	);  

Open in new window


But you don't need to make it in one declaration.
0
 
LVL 36

Expert Comment

by:ste5an
ID: 40246982
0
 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40247047
Also check this site for converting vb.net to c# and c# to vb.net:

http://converter.telerik.com/
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question