每一個。我虛心地想要在這方面尋求你的支持。 我盡我最大努力學習谷歌驅動器的SDK,並隨後在頁面上的視頻提供的,以及所有步驟: https://developers.google.com/drive/web/quickstart/quickstart-cs控制檯應用程序代碼轉換爲Windows窗體代碼VB
我也不過來阻止我實現提供的示例代碼CSharp和沒有VB版本。 我試過將它轉換爲VB使用Telerik轉換器,但結果並不令人鼓舞,因爲我仍然看到那裏有大括號,什麼不是。我知道我看到這些,因爲它的一個控制檯應用程序,我會很誠懇地說,我不太擅長控制檯應用程序代碼。
因此,我謙虛地尋求幫助,以便如何將此已轉換的C#轉換爲VB代碼 爲Windows窗體版本。謝謝。
Namespace GoogleDriveSamples
Class DriveCommandLineSample
Private Shared Sub Main(args As String())
Dim credential As UserCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(New ClientSecrets() With { _
Key .ClientId = "CLIENT_ID_HERE", _
Key .ClientSecret = "CLIENT_SECRET_HERE" _
}, New() {DriveService.Scope.Drive}, "user", CancellationToken.None).Result
' Create the service.
Dim service = New DriveService(New BaseClientService.Initializer() With { _
Key .HttpClientInitializer = credential, _
Key .ApplicationName = "Drive API Sample" _
})
Dim body As New File()
body.Title = "My document"
body.Description = "A test document"
body.MimeType = "text/plain"
Dim byteArray As Byte() = System.IO.File.ReadAllBytes("document.txt")
Dim stream As New System.IO.MemoryStream(byteArray)
Dim request As FilesResource.InsertMediaUpload = service.Files.Insert(body, stream, "text/plain")
request.Upload()
Dim file As File = request.ResponseBody
Console.WriteLine("File id: " + file.Id)
Console.WriteLine("Press Enter to end this process.")
Console.ReadLine()
End Sub
End Class
End Namespace
如果它支持C#,它怎麼可能不支持VB.NET? –
不支持vb.net,但那不是你在你的問題中所說的,你說的只是「vb」,這意味着較舊的visual basic。 –
那麼,問題中提供的示例代碼並不意味着這一點。事實上,微軟確實經常將VB.NET視爲簡單的「VB」。現在是時候從VB 6開始了。 –