401 lines
50 KiB
HTML
401 lines
50 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Set Initial Revision Example (VB.NET)</title>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
<link rel="stylesheet" type="text/css" href="ApiHelp.css">
|
|
</head>
|
|
<meta name=MS-HKWD content="VB.NET examples,revisions">
|
|
<meta name=MS-HKWD content="VB.NET examples,revision numbers">
|
|
<meta name=MS-HKWD content="VB.NET examples,revision number components">
|
|
<meta name=MS-HKWD content="VB.NET examples,card variables">
|
|
<body>
|
|
<h1><font size="1"><span style="font-weight: 400">SOLIDWORKS PDM Professional API Help</span></h1>
|
|
<h1>Set Initial Revision Example (VB.NET)</h1>
|
|
<p><a name="Top"></a>This example shows how to set the initial revision of a
|
|
file.</p>
|
|
<p><b>NOTE</b>: If using the primary interop assembly
|
|
provided with SOLIDWORKS PDM Professional, see
|
|
<a href="Using_NET_Framework_in_Applications.htm">Using .NET Framework 4.0 in
|
|
Stand-alone Applications</a>.</p>
|
|
<p><img border="0" src="InitialRevision.gif" width="238" height="157"></p>
|
|
|
|
<p style="font-family: Courier New; font-size: 13; color: black; background: white" class="APICODE"><span style="color:green;">'---------------------------------------------------------------------------------------</span><br>
|
|
<span style="color:green;">' Preconditions:</span><br>
|
|
<span style="color:green;">' 1. Start Microsoft Visual Studio.</span><br>
|
|
<span style="color:green;">' 2. Click <b>File > New > Project > Visual Basic > Windows Forms Application</b>.<br>
|
|
' 3. Select <b>.NET Framework 4</b> in the top dropdown.</span><br>
|
|
<span style="color:green;">' 4. Click <b>Browse</b> and navigate to the folder where to create the project.<br>
|
|
' 5. Type <b>SetRevision</b> in <b>Name</b>.</span><br>
|
|
<span style="color:green;">' 6. Click <b>OK</b>.</span><br>
|
|
<span style="color: #008000">'</span><span style="color:green;"> 7. Right-click the project</span> <span style="color:green;">name in the Solution Explorer and
|
|
click <b>Add Reference</b>. </span><br><span style="color: #008000">'</span><span style="color:green;"> 8. In the Add Reference dialog:</span><br><span style="color: #008000">'</span><span style="color:green;"> a. Click <b>Assemblies > Framework</b> in the left-side panel, </span><br><span style="color: #008000">'</span><span style="color:green;"> browse to the top folder of your SOLIDWORKS PDM Professional installation, </span><br><span style="color: #008000">'</span><span style="color:green;"> locate and click <b>EPDM.Interop.epdm.dll</b>, click <b>Open</b>, and click <b>Add</b>.</span><br><span style="color: #008000">'</span><span style="color:green;"> b. Click <b>Close.</b></span><br>
|
|
<span style="color:green;">' 9. Right-click <b>References > EPDM.Interop.epdm</b> in the Solution Explorer, <br>
|
|
' click <b>Properties</b>, and set E<b>mbed Interop Types </b>to <b>False</b> to handle methods <br>
|
|
' that pass arrays of structures.<br>
|
|
' 10. Create a form similar to the form shown above and change: </span><br>
|
|
<span style="color:green;">' a. Label to <b>VaultsLabel</b>.</span><br>
|
|
<span style="color:green;">' b. Combo box to <b>VaultsComboBox</b>. </span><br>
|
|
<span style="color:green;">' c. Button to <b>SetInitialRevisionButton</b>.<br>
|
|
</span>
|
|
<span style="color:green;">' 11. Click <b>Show All Files</b> in the Solution
|
|
Explorer toolbar and expand <b>Form1.vb</b>.</span><span style="color:green;"> </span><br>
|
|
<span style="color:green;">' 12. Replace the code in <b>Form1.vb</b> with <a href="#Form">this code</a>.</span><br>
|
|
<span style="color:green;">' 13. Replace the code in <b>Form1.Designer.vb</b> with <a href="#Designer">this code</a>.<br>
|
|
' 14. Copy a SOLIDWORKS part to a PDM vault view.</span><br>
|
|
<span style="color:green;">' a. Check in the part.</span><br>
|
|
<span style="color:green;">' b. Right-click the part and
|
|
click <b>
|
|
Change State > No Approval Required</b>.</span><br>
|
|
<span style="color:green;">' Part is now in the Approved state,
|
|
and data card Revision is A.</span><br>
|
|
<span style="color:green;">' c. Check out the part.</span><br>
|
|
<span style="color:green;">' d. In the part's data card, type <b>G</b> in <b>Revision</b>.</span><br>
|
|
<span style="color:green;">' e. Save the data card.</span><br>
|
|
<span style="color:green;">' f. Check in the part.</span><br>
|
|
<span style="color:green;">' 15. Click <b>Debug > Start Debugging</b> or press <b>F5</b>.</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:green;">' Postconditions: </span><br>
|
|
<span style="color:green;">' 1. The Set Revision dialog opens.</span><br>
|
|
<span style="color:green;">' 2. Select the vault containing the SOLIDWORKS part you just checked in.</span><br>
|
|
<span style="color:green;">' 3. Click <b>Set Initial Revision</b>.</span><br>
|
|
<span style="color:green;">' 4. In the Select files on which to set initial revision dialog,
|
|
click the<br>
|
|
' SOLIDWORKS part you just checked in and click <b>Open</b>.<br>
|
|
' 5. In the File already has a revision dialog, click <b>OK</b> to set the initial<br>
|
|
' revision.</span><br>
|
|
<span style="color:green;">' 6. Refresh the vault view, click the SOLIDWORKS part, and click the <b>Version</b> tab.<br>
|
|
' Observe that the local revision of the file is now G.<br>
|
|
' 7. Close the Set Revision dialog.</span><br>
|
|
<span style="color:green;">'--------------------------------------------------------------------------------------- </span><br>
|
|
<span style="color:green;"><a name="Form"></a>'Form1.vb</span></p>
|
|
<p style="font-family: Courier New; font-size: 13; color: black; background: white" class="APICODE">
|
|
<span style="color:blue;">Imports</span> EPDM.Interop.epdm<br>
|
|
<br>
|
|
<span style="color:blue;">Public</span> <span style="color:blue;">Class</span> <span style="color: #2B91AF">Form1</span><br>
|
|
<br>
|
|
<span style="color:blue;">Private</span> <span style="color:blue;">Sub</span> Form1_Load(<span style="color:blue;">ByVal</span> sender <span style="color:blue;">As</span> _<br>
|
|
System.<span style="color:#2b91af;">Object</span>, <span style="color:blue;">ByVal</span> e <span style="color:blue;">As</span> System.<span style="color:#2b91af;">EventArgs</span>) _<br>
|
|
<span style="color:blue;">Handles</span> <span style="color:blue;">MyBase</span>.Load<br>
|
|
<br>
|
|
<span style="color:blue;">Dim</span> vault <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmVault8</span> = <span style="color:blue;">New</span> <span style="color:#2b91af;">EdmVault5</span><br>
|
|
<span style="color:blue;">Dim</span> Views() <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmViewInfo</span> = {}<br>
|
|
<br>
|
|
vault.<b>GetVaultViews</b>(Views, <span style="color:blue;">False</span>)<br>
|
|
VaultsComboBox.Items.Clear()<br>
|
|
<span style="color:blue;">For</span> <span style="color:blue;">Each</span> View <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmViewInfo</span> <span style="color:blue;">In</span> Views<br>
|
|
VaultsComboBox.Items.Add(View.mbsVaultName)<br>
|
|
<span style="color:blue;">Next</span><br>
|
|
<span style="color:blue;">If</span> VaultsComboBox.Items.Count > 0 <span style="color:blue;">Then</span><br>
|
|
VaultsComboBox.Text = VaultsComboBox.Items(0)<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span><br>
|
|
<br>
|
|
<span style="color:blue;">Private</span> <span style="color:blue;">Sub</span> SetInitialRevisionButton_Click( _<br>
|
|
<span style="color:blue;">ByVal</span> sender <span style="color:blue;">As</span> System.<span style="color:#2b91af;">Object</span>, _<br>
|
|
<span style="color:blue;">ByVal</span> e <span style="color:blue;">As</span> System.<span style="color:#2b91af;">EventArgs</span>) _<br>
|
|
<span style="color:blue;">Handles</span> SetInitialRevisionButton.Click<br>
|
|
<br>
|
|
<span style="color:green;">'Declare and create an instance of IEdmVault5</span><br>
|
|
<span style="color:blue;">Dim</span> vault <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmVault5</span> = <span style="color:blue;">New</span> <span style="color:#2b91af;">EdmVault5</span>()<br>
|
|
<br>
|
|
<span style="color:green;">'Log into selected vault as the current user</span><br>
|
|
vault.<b>LoginAuto</b>(VaultsComboBox.Text, _<br>
|
|
<span style="color:blue;">Me</span>.Handle.ToInt32())<br>
|
|
<br>
|
|
<span style="color:green;">'Display a File Open dialog for user to</span><br>
|
|
<span style="color:green;">'choose the files on which set the initial revision</span><br>
|
|
<span style="color:blue;">Dim</span> PathList <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmStrLst5</span><br>
|
|
PathList = vault.<b>BrowseForFile</b>( _<br>
|
|
<span style="color:blue;">Me</span>.Handle.ToInt32(), _<br>
|
|
<span style="color:#2b91af;">EdmBrowseFlag</span>.EdmBws_ForOpen + _<br>
|
|
<span style="color:#2b91af;">EdmBrowseFlag</span>.EdmBws_PermitMultipleSel + _<br>
|
|
<span style="color:#2b91af;">EdmBrowseFlag</span>.EdmBws_PermitVaultFiles, _<br>
|
|
<span style="color:#a31515;">"SOLIDWORKS files "</span> + _<br>
|
|
<span style="color:#a31515;">"(*.sldprt; *.sldasm; *.slddrw)|"</span> + _<br>
|
|
<span style="color:#a31515;">"*.sldprt;*.sldasm;*.slddrw|"</span> + _<br>
|
|
<span style="color:#a31515;">"All Files (*.*)|*.*||"</span>, _<br>
|
|
<span style="color:#a31515;">""</span>, <span style="color:#a31515;">""</span>, vault.<b>RootFolderPath</b>, _<br>
|
|
<span style="color:#a31515;">"Select Files to Set Initial Revision on"</span>)<br>
|
|
<br>
|
|
<span style="color:green;">'Exit if the user clicks Cancel</span><br>
|
|
<span style="color:blue;">If</span> PathList <span style="color:blue;">Is</span> <span style="color:blue;">Nothing</span> <span style="color:blue;">Then</span> <span style="color:blue;">Exit Sub</span><br>
|
|
<br>
|
|
<span style="color:green;">'Traverse the selected files</span><br>
|
|
<span style="color:blue;">Dim</span> pos <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmPos5</span><br>
|
|
pos = PathList.<b>GetHeadPosition</b><br>
|
|
<span style="color:blue;">While</span> <span style="color:blue;">Not</span> pos.<b>IsNull</b><br>
|
|
<span style="color:green;">'Get each file path from the selected files list</span><br>
|
|
<span style="color:blue;">Dim</span> FilePath <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
FilePath = PathList.<b>GetNext</b>(pos)<br>
|
|
<span style="color:green;">'Get the IEdmFile5 object corresponding</span><br>
|
|
<span style="color:green;">'to the path</span><br>
|
|
<span style="color:blue;">Dim</span> FileObj <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmFile5</span><br>
|
|
FileObj = vault.<b>GetFileFromPath</b>(FilePath)<br>
|
|
<br>
|
|
<span style="color:green;">'Skip any files that are checked out</span><br>
|
|
<span style="color:blue;">If</span> FileObj.<b>IsLocked</b> <span style="color:blue;">Then</span><br>
|
|
<span style="color:#2b91af;">MessageBox</span>.Show(FilePath + _<br>
|
|
<span style="color:#a31515;">" is checked out."</span> _<br>
|
|
+ vbCrLf + <span style="color:#a31515;">"Check it in and try again."</span> _<br>
|
|
+ vbCrLf + <span style="color:#a31515;">"Skipping this file."</span>, _<br>
|
|
<span style="color:#a31515;">"File is checked out."</span>, _<br>
|
|
<span style="color:#2b91af;">MessageBoxButtons</span>.OK, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Warning)<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:green;">'Get the value of the file data</span><br>
|
|
<span style="color:green;">'card variable
|
|
named Revision</span><br>
|
|
<span style="color:blue;">Dim</span> EnumVarObj <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmEnumeratorVariable8</span><br>
|
|
<span style="color:green;">'Keeps the file open</span><br>
|
|
EnumVarObj = FileObj.<b>GetEnumeratorVariable</b><br>
|
|
<br>
|
|
<span style="color:blue;">Dim</span> GetVarSuccess <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span><br>
|
|
<span style="color:green;">'GetVar returns a Variant</span><br>
|
|
<span style="color:blue;">Dim</span> RevisionObj <span style="color:blue;">As</span> <span style="color:blue;">Object</span> = <span style="color:blue;">Nothing</span><br>
|
|
GetVarSuccess = EnumVarObj.<b>GetVar</b>(<span style="color:#a31515;">"Revision"</span>, _<br>
|
|
<span style="color:#a31515;">"@"</span>, RevisionObj)<br>
|
|
EnumVarObj.<b>CloseFile</b>(<span style="color:blue;">False</span>) <span style="color:green;">'Pass True to flush</span><br>
|
|
<br>
|
|
<span style="color:green;">'Skip any files without a Revision </span><br>
|
|
<span style="color:green;">'card variable value</span><br>
|
|
<span style="color:blue;">If</span> RevisionObj <span style="color:blue;">Is</span> <span style="color:blue;">Nothing</span> <span style="color:blue;">Then</span><br>
|
|
<span style="color:#2b91af;">MessageBox</span>.Show(<span style="color:#a31515;">"The ""Revision"" custom "</span> + _<br>
|
|
<span style="color:#a31515;">"property of "</span> + FilePath + _<br>
|
|
<span style="color:#a31515;">" is not set to a value."</span> _<br>
|
|
+ vbCrLf + <span style="color:#a31515;">"Skipping this file."</span>, _<br>
|
|
<span style="color:#a31515;">"Revision custom property empty."</span>, _<br>
|
|
<span style="color:#2b91af;">MessageBoxButtons</span>.OK, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Warning)<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:green;">'Check type</span><br>
|
|
<span style="color:blue;">Dim</span> RevType <span style="color:blue;">As</span> System.<span style="color:#2b91af;">Type</span><br>
|
|
RevType = RevisionObj.GetType()<br>
|
|
<span style="color:blue;">If</span> <span style="color:blue;">Not</span> RevType.Name = <span style="color:#a31515;">"String"</span> <span style="color:blue;">Then</span><br>
|
|
<span style="color:#2b91af;">MessageBox</span>.Show(<span style="color:#a31515;">"The ""Revision"" "</span> + _<br>
|
|
<span style="color:#a31515;">"variable type is not ""String""."</span> _<br>
|
|
+ vbCrLf + <span style="color:#a31515;">"Skipping this file."</span>, _<br>
|
|
<span style="color:#a31515;">"Revision custom property empty."</span>, _<br>
|
|
<span style="color:#2b91af;">MessageBoxButtons</span>.OK, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Warning)<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:blue;">Dim</span> RevisionProp <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
RevisionProp = RevisionObj<br>
|
|
<br>
|
|
<span style="color:green;">'Skip any files whose Revision value</span><br>
|
|
<span style="color:green;">'is not formatted appropriately</span><br>
|
|
<span style="color:blue;">If</span> <span style="color:blue;">Not</span> RevisionProp.Length = 1 <span style="color:blue;">Then</span><br>
|
|
<span style="color:#2b91af;">MessageBox</span>.Show(<span style="color:#a31515;">"The ""Revision"" custom "</span> + _<br>
|
|
<span style="color:#a31515;">"property of "</span> + FilePath + _<br>
|
|
<span style="color:#a31515;">" does not conform to the expected "</span> + _<br>
|
|
<span style="color:#a31515;">"revision number format."</span> + vbCrLf + _<br>
|
|
<span style="color:#a31515;">"Skipping this file."</span>, _<br>
|
|
<span style="color:#a31515;">"Revision custom property in the wrong format."</span>, _<br>
|
|
<span style="color:#2b91af;">MessageBoxButtons</span>.OK, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Warning)<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:green;">'Create an IEdmRevisionMgr2 object</span><br>
|
|
<span style="color:blue;">Dim</span> RevMgr <span style="color:blue;">As</span> <span style="color:#2b91af;">IEdmRevisionMgr2</span><br>
|
|
RevMgr = vault.<b>CreateUtility</b>( _<br>
|
|
<span style="color:#2b91af;">EdmUtility</span>.<b>EdmUtil_RevisionMgr</b>)<br>
|
|
<br>
|
|
<span style="color:green;">'Get the revision number ID</span><br>
|
|
<span style="color:blue;">Dim</span> CanIncrement <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span><br>
|
|
<span style="color:blue;">Dim</span> RevisionNumberID <span style="color:blue;">As</span> <span style="color:blue;">Long</span><br>
|
|
<span style="color:green;">'Return 0 if there is no revision number</span><br>
|
|
<span style="color:green;">'generator defined for the file's current state</span><br>
|
|
RevisionNumberID = _<br>
|
|
RevMgr.<b>GetRevisionNumberIDFromFile</b>( _<br>
|
|
FileObj.<b>ID</b>, CanIncrement)<br>
|
|
<br>
|
|
<span style="color:green;">'Skip this file if there is no</span><br>
|
|
<span style="color:green;">'revision number generator for it</span><br>
|
|
<span style="color:blue;">If</span> RevisionNumberID = 0 <span style="color:blue;">Then</span><br>
|
|
<span style="color:#2b91af;">MessageBox</span>.Show(<span style="color:#a31515;">"Move "</span> + FilePath + _<br>
|
|
<span style="color:#a31515;">" to a state where a Revision Number "</span> + _<br>
|
|
<span style="color:#a31515;">"is defined."</span> + vbCrLf + _<br>
|
|
<span style="color:#a31515;">"Skipping this file."</span>, _<br>
|
|
<span style="color:#a31515;">"No Revision Number is defined "</span> + _<br>
|
|
<span style="color:#a31515;">"for this state."</span>, <span style="color:#2b91af;">MessageBoxButtons</span>.OK, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Warning)<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:green;">'Get the revision number info for this file</span><br>
|
|
<span style="color:blue;">Dim</span> RevNumbers() <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmRevNo</span> = {}<br>
|
|
RevMgr.<b>GetRevisionNumbers</b>(RevisionNumberID, _<br>
|
|
RevNumbers)<br>
|
|
<span style="color:blue;">Dim</span> RevNoFormatString <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
RevNoFormatString = RevNumbers(0).<b>mbsData</b><br>
|
|
<span style="color:blue;">Dim</span> RevNoFormatLiteral <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
<span style="color:blue;">Dim</span> PercentPos <span style="color:blue;">As</span> <span style="color:blue;">Integer</span><br>
|
|
PercentPos = RevNoFormatString.IndexOf(<span style="color:#a31515;">"%"</span>)<br>
|
|
RevNoFormatLiteral = _<br>
|
|
RevNoFormatString.Substring(0, PercentPos)<br>
|
|
<span style="color:blue;">Dim</span> NewRev <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
NewRev = RevNoFormatLiteral + RevisionProp<br>
|
|
<br>
|
|
<span style="color:green;">'Check the file's current revision</span><br>
|
|
<span style="color:blue;">Dim</span> CurRev <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
CurRev = FileObj.<b>CurrentRevision</b><br>
|
|
<br>
|
|
<span style="color:green;">'Give the user the option to skip this file</span><br>
|
|
<span style="color:green;">'if it already has a revision set</span><br>
|
|
<span style="color:blue;">If</span> <span style="color:blue;">Not</span> CurRev = <span style="color:blue;">String</span>.Empty <span style="color:blue;">Then</span><br>
|
|
<span style="color:blue;">Dim</span> MsgBoxResult <span style="color:blue;">As</span> _<br>
|
|
System.Windows.Forms.<span style="color:#2b91af;">DialogResult</span><br>
|
|
MsgBoxResult = <span style="color:#2b91af;">MessageBox</span>.Show( _<br>
|
|
<span style="color:#a31515;">"The current revision of "</span> _<br>
|
|
+ FilePath + <span style="color:#a31515;">" is """</span> + CurRev + <span style="color:#a31515;">"""."</span> + _<br>
|
|
vbCrLf + <span style="color:#a31515;">"The new revision will be """</span> + _<br>
|
|
NewRev + <span style="color:#a31515;">""""</span> + vbCrLf _<br>
|
|
+ <span style="color:#a31515;">"Would you like to continue?"</span>, _<br>
|
|
<span style="color:#a31515;">"File already has a revision"</span>, _<br>
|
|
<span style="color:#2b91af;">MessageBoxButtons</span>.OKCancel, _<br>
|
|
<span style="color:#2b91af;">MessageBoxIcon</span>.Question)<br>
|
|
<span style="color:blue;">If</span> MsgBoxResult = _<br>
|
|
Windows.Forms.<span style="color:#2b91af;">DialogResult</span>.Cancel <span style="color:blue;">Then</span> _<br>
|
|
<span style="color:blue;">Continue While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<br>
|
|
<span style="color:green;">'Get the revision number components for the </span><br>
|
|
<span style="color:green;">'revision number used by this file</span><br>
|
|
<span style="color:blue;">Dim</span> RevComponents() <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmRevComponent2</span> = {}<br>
|
|
RevMgr.<b>GetRevisionNumberComponents2</b>( _<br>
|
|
-RevisionNumberID, RevComponents)<br>
|
|
<span style="color:blue;">Dim</span> RevComponentName <span style="color:blue;">As</span> <span style="color:blue;">String</span><br>
|
|
RevComponentName = _<br>
|
|
RevComponents(0).<b>mbsComponentName</b><br>
|
|
<br>
|
|
<span style="color:green;">'Declare an array of EdmRevCounter structures,</span><br>
|
|
<span style="color:green;">'even though only
|
|
one is used,</span><br>
|
|
<span style="color:green;">'and assign the values to set</span><br>
|
|
<span style="color:blue;">Dim</span> RevCounters(0) <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmRevCounter</span><br>
|
|
<span style="color:green;">'Assign the name of the revision counter</span><br>
|
|
<span style="color:green;">'to set</span><br>
|
|
RevCounters(0).<b>mbsComponentName</b> = _<br>
|
|
RevComponentName<br>
|
|
<span style="color:green;">'Assign the new revision counter value to the</span><br>
|
|
<span style="color:green;">'value stored in the Revision card variable</span><br>
|
|
<span style="color:green;">'converted to an integer</span><br>
|
|
<span style="color:blue;">Dim</span> RevInt <span style="color:blue;">As</span> <span style="color:blue;">Long</span><br>
|
|
RevInt = _<br>
|
|
Asc(RevisionProp.ToUpper()) - Asc(<span style="color:#a31515;">"A"</span>) + 1<br>
|
|
RevCounters(0).<b>mlCounter</b> = RevInt<br>
|
|
<br>
|
|
<span style="color:green;">'Set the revision counter to the new values</span><br>
|
|
RevMgr.<b>SetRevisionCounters</b>(FileObj.ID, _<br>
|
|
RevCounters)<br>
|
|
<br>
|
|
<span style="color:green;">'Set the revision of the file to the new values</span><br>
|
|
RevMgr.<b>IncrementRevision</b>(FileObj.ID)<br>
|
|
<br>
|
|
<span style="color:green;">'Save the new values to the database</span><br>
|
|
<span style="color:blue;">Dim</span> RevErrors() <span style="color:blue;">As</span> <span style="color:#2b91af;">EdmRevError</span> = {}<br>
|
|
RevMgr.<b>Commit</b>(<span style="color:#a31515;">"Set starting revision for "</span> + _<br>
|
|
<span style="color:#a31515;">"legacy file."</span>, RevErrors)<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">While</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Class</span></p>
|
|
<div align="center">
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><a href="#Top">Back to top</a></pre>
|
|
</div>
|
|
<pre style="font-family: Courier New; font-size: 13; color: black; background: white"><span style="color:green;"><a name="Designer"></a>'Form1.Designer.vb</span>
|
|
</pre>
|
|
|
|
<p style="font-family: Courier New; font-size: 13; color: black; background: white" class="APICODE">
|
|
<<span style="color:blue;">Global</span>.Microsoft.VisualBasic.CompilerServices.<span style="color:#2b91af;">DesignerGenerated</span>()> _<br>
|
|
<span style="color:blue;">Partial</span> <span style="color:blue;">Class</span> <span style="color: #2B91AF">Form1</span><br>
|
|
<span style="color:blue;">Inherits</span> System.Windows.Forms.<span style="color:#2b91af;">Form</span><br>
|
|
<br>
|
|
<span style="color:green;">'Form overrides dispose to clean up the component list.</span><br>
|
|
<System.Diagnostics.<span style="color:#2b91af;">DebuggerNonUserCode</span>()> _<br>
|
|
<span style="color:blue;">Protected</span> <span style="color:blue;">Overrides</span> <span style="color:blue;">Sub</span> Dispose(<span style="color:blue;">ByVal</span> disposing <span style="color:blue;">As</span> <span style="color:blue;">Boolean</span>)<br>
|
|
<span style="color:blue;">Try</span><br>
|
|
<span style="color:blue;">If</span> disposing <span style="color:blue;">AndAlso</span> components <span style="color:blue;">IsNot</span> <span style="color:blue;">Nothing</span> <span style="color:blue;">Then</span><br>
|
|
components.Dispose()<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">If</span><br>
|
|
<span style="color:blue;">Finally</span><br>
|
|
<span style="color:blue;">MyBase</span>.Dispose(disposing)<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Try</span><br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span><br>
|
|
<br>
|
|
<span style="color:green;">'Required by the Windows Form Designer</span><br>
|
|
<span style="color:blue;">Private</span> components <span style="color:blue;">As</span> System.ComponentModel.<span style="color:#2b91af;">IContainer</span><br>
|
|
<br>
|
|
<span style="color:green;">'NOTE: The following procedure is required by the Windows Form Designer</span><br>
|
|
<span style="color:green;">'It can be modified using the Windows Form Designer. </span><br>
|
|
<span style="color:green;">'Do not modify it using the code editor.</span><br>
|
|
<System.Diagnostics.<span style="color:#2b91af;">DebuggerStepThrough</span>()> _<br>
|
|
<span style="color:blue;">Private</span> <span style="color:blue;">Sub</span> InitializeComponent()<br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Label</span>()<br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">ComboBox</span>()<br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span>()<br>
|
|
<span style="color:blue;">Me</span>.SuspendLayout()<br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:green;">'VaultsLabel</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.AutoSize = <span style="color:blue;">True</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.Location = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Point</span>(22, 16)<br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.Margin = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Padding</span>(2, 0, 2, 0)<br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.Name = <span style="color:#a31515;">"VaultsLabel"</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.Size = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Size</span>(136, 13)<br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.TabIndex = 10<br>
|
|
<span style="color:blue;">Me</span>.VaultsLabel.Text = <span style="color:#a31515;">"Select Preferred Vault View"</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:green;">'VaultsComboBox</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.FormattingEnabled = <span style="color:blue;">True</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.Location = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Point</span>(26, 32)<br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.Margin = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Padding</span>(2, 2, 2, 2)<br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.Name = <span style="color:#a31515;">"VaultsComboBox"</span><br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.Size = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Size</span>(132, 21)<br>
|
|
<span style="color:blue;">Me</span>.VaultsComboBox.TabIndex = 11<br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:green;">'SetInitialRevisionButton</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.Location = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Point</span>(41, 57)<br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.Margin = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Padding</span>(2, 2, 2, 2)<br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.Name = <span style="color:#a31515;">"SetInitialRevisionButton"</span><br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.Size = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Size</span>(101, 41)<br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.TabIndex = 14<br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.Text = <span style="color:#a31515;">"Set Initial Revision"</span><br>
|
|
<span style="color:blue;">Me</span>.SetInitialRevisionButton.UseVisualStyleBackColor = <span style="color:blue;">True</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:green;">'Form1</span><br>
|
|
<span style="color:green;">'</span><br>
|
|
<span style="color:blue;">Me</span>.AutoScaleDimensions = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">SizeF</span>(6.0!, 13.0!)<br>
|
|
<span style="color:blue;">Me</span>.AutoScaleMode = System.Windows.Forms.<span style="color:#2b91af;">AutoScaleMode</span>.Font<br>
|
|
<span style="color:blue;">Me</span>.ClientSize = <span style="color:blue;">New</span> System.Drawing.<span style="color:#2b91af;">Size</span>(222, 119)<br>
|
|
<span style="color:blue;">Me</span>.Controls.Add(<span style="color:blue;">Me</span>.SetInitialRevisionButton)<br>
|
|
<span style="color:blue;">Me</span>.Controls.Add(<span style="color:blue;">Me</span>.VaultsComboBox)<br>
|
|
<span style="color:blue;">Me</span>.Controls.Add(<span style="color:blue;">Me</span>.VaultsLabel)<br>
|
|
<span style="color:blue;">Me</span>.Margin = <span style="color:blue;">New</span> System.Windows.Forms.<span style="color:#2b91af;">Padding</span>(2, 2, 2, 2)<br>
|
|
<span style="color:blue;">Me</span>.Name = <span style="color:#a31515;">"Form1"</span><br>
|
|
<span style="color:blue;">Me</span>.Text = <span style="color:#a31515;">"Set Revision"</span><br>
|
|
<span style="color:blue;">Me</span>.ResumeLayout(<span style="color:blue;">False</span>)<br>
|
|
<span style="color:blue;">Me</span>.PerformLayout()<br>
|
|
<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Sub</span><br>
|
|
<span style="color:blue;">Friend</span> <span style="color:blue;">WithEvents</span> VaultsLabel <span style="color:blue;">As</span> System.Windows.Forms.<span style="color:#2b91af;">Label</span><br>
|
|
<span style="color:blue;">Friend</span> <span style="color:blue;">WithEvents</span> VaultsComboBox <span style="color:blue;">As</span> System.Windows.Forms.<span style="color:#2b91af;">ComboBox</span><br>
|
|
<span style="color:blue;">Friend</span> <span style="color:blue;">WithEvents</span> SetInitialRevisionButton <span style="color:blue;">As</span> System.Windows.Forms.<span style="color:#2b91af;">Button</span><br>
|
|
<br>
|
|
<span style="color:blue;">End</span> <span style="color:blue;">Class</span></p>
|
|
|
|
<p align="center"><a href="#Top">Back to top</a></p>
|
|
|
|
</body>
|
|
|
|
</html>
|