Hide Table of Contents

This topic describes how to create a VB.NET stand-alone application that logs into a SOLIDWORKS Enterprise PDM file vault and lists the files in the root folder.

  1. Start up Microsoft Visual Studio 2010.

  2. Click File > New Project > Visual Basic > Windows Forms Application.

    1. Type StandaloneApplicationVBNET in Name.

    2. Click Browse and navigate to the folder where to create the project.

    3. Click OK.

    4. Right-click the name of your project in the Solution Explorer and select Add Reference to add the SOLIDWORKS Enterprise PDM primary assembly interop to your project.

      1. Browse to the top folder of your SOLIDWORKS Enterprise PDM installation, typically C:\Program Files\SOLIDWORKS Enterprise PDM.
         
      2. Locate and click EPDM.Interop.epdm.dll.
         
      3. Click Open.
         
      4. Click Add.
         
      5. Click Close.
  3. If using the SOLIDWORKS Enterprise PDM .NET Framework 4.0 primary interop assembly, change the version of the .NET Framework and the target.

    1. Click Project > StandaloneApplicationVBNET Properties > Compile > Advanced Compile Options.
       
    2. Set Target CPU to AnyCPU.
       
    3. Set Target framework (all configurations) to .NET Framework 4.
       
    4. Click OK.
       
    5. Click Yes.

     

  4. Right-click Form1.vb in the Solution Explorer and click View Designer.

  5. Click View > Toolbox.

  6. Drag a button from the Toolbox onto the form.

  7. Double-click the button to open Form1.vb and replace all of the code in the code window with the following code.

Imports EPDM.Interop.epdm
 
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        On Error GoTo ErrHandler
 
        'Create a file vault interface and log in to a vault
        Dim vault As IEdmVault5 = New EdmVault5
        vault.LoginAuto("MyVaultName"Me.Handle.ToInt32)
 
        'Get the vault's root folder interface 
        Dim message As String
        Dim file As IEdmFile5
        Dim folder As IEdmFolder5
        folder = vault.RootFolder
 
        'Get position of first file in the root folder 
        Dim pos As IEdmPos5
        pos = folder.GetFirstFilePosition
        If pos.IsNull Then
            message = "The root folder of your vault does not contain any files."
        Else
            message = "The root folder of your vault contains these files:" + vbLf
        End If
 
        'For all files in the root folder, append the name to the message
        While Not pos.IsNull
            file = folder.GetNextFile(pos)
            message = message + file.Name + vbLf
        End While
 
        'Show the names of all files in the root folder 
        MsgBox(message)
 
        Exit Sub
 
ErrHandler:
        If vault Is Nothing Then
            MsgBox("Could not create vault interface.")
        Else
            Dim ErrName As String
            Dim ErrDesc As String
            vault.GetErrorString(Err.Number, ErrName, ErrDesc)
            MsgBox("Something went wrong." + vbLf + ErrName + vbLf + ErrDesc)
        End If
 
    End Sub
 
End Class 
  1. Replace MyVaultName in the code with the name of a SOLIDWORKS Enterprise PDM vault on your computer.

  2. Click Debug > Start Debugging or press F5.

    1. Click Button1 on the form.

      A message box is displayed that either contains the names of the files in the root folder of the specified vault or informs you that the root folder of the specified vault does not contain any files.

    2. Close the form.

  1. Click File > Save All.

 See Also

Stand-alone Applications (C#)

Stand-alone Applications (C++)



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   Stand-alone Applications (VB.NET)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:



x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2015 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.