Returns the next Document Numbers generated from NumberGenerator.dat file.
Visual Basic |
---|
Public Function GetNextDocumentNumbers( _ ByVal countOfFiles As Integer, _ ByRef pVarPrefix As Variant, _ ByRef pVarDocNumbs As Variant _ ) As Long |
Imports System.Runtime.InteropServices Imports System.IO Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objApp As SolidEdgeFramework.Application = Nothing Dim iCountOfDocNum As Integer iCountOfDocNum = 5 Dim objDocumentNumList() As Object Erase objDocumentNumList Dim strPrefix As Object strPrefix = "" Dim GetNextDocumentNumbersHR As Integer = 0 Try 'Get Solid Edge Object objApp = Marshal.GetActiveObject("SolidEdge.Application") If Not objApp Is Nothing Then GetNextDocumentNumbersHR = objApp.GetNextDocumentNumbers(iCountOfDocNum, strPrefix, objDocumentNumList) If GetNextDocumentNumbersHR <> 0 Then 'Fail Else 'Success End If End If Catch ex As Exception MsgBox(ex.ToString) End Try End Sub End Class
using System; using System.Windows.Forms; using System.Runtime.InteropServices; using System.IO; public class Form1 { private void Button1_Click(object sender, EventArgs e) { SolidEdgeFramework.Application objApp = null; int iCountOfDocNum = 5; object[] objDocumentNumList = null; objDocumentNumList = null; object strPrefix = ""; int GetNextDocumentNumbersHR = 0; try { //Get Solid Edge Object objApp = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application"); if (objApp != null) { GetNextDocumentNumbersHR = objApp.GetNextDocumentNumbers(iCountOfDocNum, strPrefix, objDocumentNumList); if (GetNextDocumentNumbersHR != 0) { //Fail } else { //Success } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } public Form1() { SubscribeToEvents(); } //Converted event handler wireups: private bool EventsSubscribed = false; private void SubscribeToEvents() { if (EventsSubscribed) return; else EventsSubscribed = true; Button1.Click += Button1_Click; Button1.Click += Button1_Click; Button1.Click += Button1_Click; Button1.Click += Button1_Click; Button1.Click += Button1_Click; } }