Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Unanswered: Converting from VB.Net to VB

    I have some code I need to convert from VB.net to VB or VBA (I will be using it in Access 2010). The code is to upload a document to a SharePoint library (using the SharePoint Foundation 2010 Managed COM). The original code was in C#. I used a C# to VB.Net converter to get it into VB.Net. Now I need to get it into VB or VBA. Is it possible?

    Here is the original C# code:

    using System;
    using System.IO;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    using Microsoft.SharePoint.Client;
    // The following directive avoids ambiguity between the
    // System.IO.File class and Microsoft.SharePoint.Client.File class.
    using ClientOM = Microsoft.SharePoint.Client;
    class Program
    {
    static void Main(string[] args)
    {
    ClientContext clientContext =
    new ClientContext("http://intranet.contoso.com");
    using (FileStream fileStream =
    new FileStream("NewDocument.docx", FileMode.Open))
    ClientOM.File.SaveBinaryDirect(clientContext,
    "/Shared Documents/NewDocument.docx", fileStream, true);
    }
    }

    And here is the code after it was converted to VB.Net:

    Imports System.IO
    Imports DocumentFormat.OpenXml.Packaging
    Imports DocumentFormat.OpenXml.Wordprocessing
    Imports Microsoft.SharePoint.Client
    ' The following directive avoids ambiguity between the
    ' System.IO.File class and Microsoft.SharePoint.Client.File class.
    Imports ClientOM = Microsoft.SharePoint.Client
    Class Program
    Private Shared Sub Main(args As String())
    Dim clientContext As New ClientContext("http://intranet.contoso.com")
    Using fileStream As New FileStream("NewDocument.docx", FileMode.Open)
    ClientOM.File.SaveBinaryDirect(clientContext, "/Shared Documents/NewDocument.docx", fileStream, True)
    End Using
    End Sub
    End Class

    Any idea how this would look in VB or VBA?

    Thanks!

    Neil

  2. #2
    Join Date
    Sep 2012
    Posts
    0
    there are lots of tools to convert vb.net To Visual Basic , you just google it man .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •