bcsf10m011 / google-api-for-dotnet

Automatically exported from code.google.com/p/google-api-for-dotnet
0 stars 0 forks source link

How to use this API in VB.Net #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi ,

Please give some samples how to use this API in VB.Net. the help file is 
has sytax for C#,VB.Net but samples is there for C# not for VB.

Please provide the same.

Thanks a lot.
Chaitanya
+91-9900607311

Original issue reported on code.google.com by chaitanyainfy@gmail.com on 17 Dec 2009 at 9:31

GoogleCodeExporter commented 9 years ago
Add a Reference to the DLL, and then do something like this:

Dim GoogleTransClient As New Google.API.Translate.TranslateClient()
Dim TextString As String = "Text To Translate"
Dim TranslatedString As String = GoogleTransClient.Translate(TextString,
Google.API.Language.English, Google.API.Langauge.Spanish,
Google.API.Translate.TranslateFormat.text)

Original comment by QuantumR...@gmail.com on 31 Dec 2009 at 7:19

GoogleCodeExporter commented 9 years ago
Hellow,

Thanks for replying me, I am new to Visual studio, can you please let me know 
which 
project type i can take and use the code provided.

Right now i have taken Vb.Net console application and added the the DLL as 
reference 
and then pasted the code in the code window,but it is giving lot of errors. 
Please 
suggest.

Thanks for your support.
Chaitanya

Original comment by chaitanyainfy@gmail.com on 1 Jan 2010 at 3:18

GoogleCodeExporter commented 9 years ago

Original comment by iron9li...@gmail.com on 21 Mar 2010 at 4:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You may use a Console Application if u want to run the project.

Below is the working code for a vb console:

'Imports the Translate API 
Imports Google.API.Translate
Imports Google.API.Translate.Language

Module Module1
 ' Created by Haze, NYP Student

    Sub Main()
        'Call a name UseM to use the Google DLL API Translate client
        Dim UseM As New Google.API.Translate.TranslateClient("www.google.com")

        'Call a string named as "text" to take in the language to be translated
        Dim text As String = "我喜欢跑步"

        'Create a string named "Result" to read the translated language
        Dim Result As String = UseM.Translate(text, Language.ChineseSimplified,
Language.English)

        'To display the Result in a console
        Console.WriteLine(Result)

    End Sub

End Module

**Notes**
1) You must add DLL reference using add refernece  
2) A console application would be closed once loading is successful. Thus, to 
view
result, run without debugging. You may Press Ctrl + F5 for Visual Studio project

Solution Created by Haze, NYP Student

Original comment by 0740...@gmail.com on 26 Mar 2010 at 12:54

GoogleCodeExporter commented 9 years ago
Thanks,  074023f.

Original comment by iron9li...@gmail.com on 26 Mar 2010 at 6:31

GoogleCodeExporter commented 9 years ago
Hello Guys, I'm new in VB.net I'm trying to translate text to any languages but 
I end up failed I copy the code above but still error

Original comment by abdulgaf...@gmail.com on 18 Mar 2015 at 8:24