<xml> </xml>

SOLIDWORKS PDM Professional API Help | Send Feedback
SetVar Method (IEdmEnumeratorVariable5)
See Also Example

Collapse All Expand All Language Filter: All Language Filter: Multiple Language Filter: Visual Basic Language Filter: C# Language Filter: C++/CLI

EPDM.Interop.epdm Namespace > IEdmEnumeratorVariable5 Interface : SetVar Method (IEdmEnumeratorVariable5)

Visual Basic
C#
C++/CLI

bsVarName
  Name of variable to write

bsCfgName
  Name of configuration or layout to which to store the variable value; empty string for folders and file types that do not support configurations

poValue
  Variable value

bOnlyIfPartOfCard
  True to store the variable only if it is part of the file or folder data card, false to store the variable as hidden data if it is not part of the file or folder data card

Sets the value of the specified variable in this file or folder.

# Syntax

Visual Basic |
--- | ---

    Sub SetVar( _
       ByVal bsVarName As System.String, _
       ByVal bsCfgName As System.String, _
       ByRef poValue As System.Object, _
       Optional ByVal bOnlyIfPartOfCard As System.Boolean _
    )

C# |
--- | ---

    void SetVar(
       System.string bsVarName,
       System.string bsCfgName,
       ref System.object poValue,
       System.bool bOnlyIfPartOfCard
    )

C++/CLI |
--- | ---

    void SetVar(
    &   System.String^ bsVarName,
    &   System.String^ bsCfgName,
    &   System.Object^% poValue,
    &   System.bool bOnlyIfPartOfCard
    )

#### Parameters

bsVarName
  Name of variable to write
bsCfgName
  Name of configuration or layout to which to store the variable value; empty string for folders and file types that do not support configurations
poValue
  Variable value
bOnlyIfPartOfCard
  True to store the variable only if it is part of the file or folder data card, false to store the variable as hidden data if it is not part of the file or folder data card

# Example

Change Card Variables Add-in (C#)
Change Card Variables Add-in (VB.NET)
Set Part Number Using Default Serial Numbers (C#)
Set Part Number Using Default Serial Numbers (VB.NET)

# Remarks

To specify bsCfgName:

- Call IEdmFile5::GetConfigurations to get the available configuration names for this file.
- If this method is used in your add-in's implementation of IEdmAddIn5::OnCmd, then a list of configuration names for the data card is returned in ppoData that can be cast to EdmCmdData. EdmCmdData.mpoExtra contains an IEdmStrLst5 of configuration names.

After calling this method to update the variables that can be updated, you must call IEdmEnumeratorVariable5::Flush or IEdmEnumeratorVariable8::CloseFile with the bFlush argument set to true in order to ensure that the changes are saved properly to the file or folder.

Return codes:

- S_OK: The method successfully executed.
- S_FALSE: The variable was not found, and bOnlyIfPartOfCard is true.
- E_EDM_FILE_NOT_LOCKED_BY_YOU: The file is not checked out.

# See Also

####

IEdmEnumeratorVariable5 Interface
IEdmEnumeratorVariable5 Members
IEdmEnumeratorVariable10::GetVar2 Method ()
IEdmEnumeratorVariable10::GetVarAsText Method ()

# Availability

SOLIDWORKS PDM Professional Version 5.2