Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim strTextToConvert As String
Dim objInternetExplorer As SHDocVw.InternetExplorer
Dim strInputLangId As String
Dim strOutputLangId As String
'Open the excel
strTextToConvert = TextBox1.Text
If strTextToConvert = "" Then Exit Sub
' Tools Reference Select Microsoft internet Control
objInternetExplorer = CreateObject("InternetExplorer.Application")
'INPUT LANGUAGE
strInputLangId = "auto"
'output language
strOutputLangId = "en"
'open website
objInternetExplorer.Visible = True
objInternetExplorer.Navigate("http://translate.google.cn/#" & strInputLangId & "/" & strOutputLangId & "/" & strTextToConvert & "")
'' 目前状态:
''可以打开google翻译网页,并翻译出已输入在textbox1中的内容。
''要求:
''1:将翻译后的 英文 结果返回至textbox2中,请提供VB.NET或者C#代码
''2:下面msgbox中的内容是js中的,但在C#或者VB.NET中无法使用,请参考
''MsgBox(objInternetExplorer.Document.getElementById("result_box").innerHTML)
End Sub