Send Topic Feedback | See Object Hierarchy Chart
PC-DMIS 2023.1 Object Library
GetNext Method
Description
This method returns a new instance of the command that follows the current command in the Commands object. Unlike Next, this method does not change the current command but instead returns a new Command object.
Syntax
Visual Basic
Public Function GetNext() As Command
Return Type
Command object of the next command.
Example
This method, returns the next command, and shows it's description and id.
private void UseGetNextButton_Click(object sender, EventArgs e)
    {
      if (theApp == null || theApp.ActivePartProgram == null)
      {
        AddMessage(@"UseGetNextButton_Click: theApp == null || theApp.ActivePartProgram == null)");
        return;
      }

      AddMessage(@" ");
      AddMessage(@"---------------------------------------------------------------------------");

      var commands = theApp.ActivePartProgram.Commands;
      var startCommand = commands.Item(1);
      var count = 0;
      var iterCommand = startCommand.GetNext();
      int startHiPart = 0;
      int startLoPart = 0;
      startCommand.GetUniqueID(ref startHiPart, ref startLoPart);
      var methodName = @"GetNext()";
      AddMessage($@"Using {methodName} method. StartCommand <{startCommand.TypeDescription}> Uid<{startHiPart}:{startLoPart}>");

      while (iterCommand != null)
      {
        count++;
        CompareCommands(iterCommand, methodName, count, startCommand, startHiPart, startLoPart);
        iterCommand = iterCommand.GetNext();
      }

      AddMessage(@"---------------------------------------------------------------------------");
      AddMessage(@" ");

      GC.Collect();
    }
See Also