Function NextBusByNumber

 

Function NextBusByNumber( ByRef hHandle ) As Long

Purpose: Gets the handle of next bus in a bus list which has been sorted by bus number.

Works in:      OneLiner and Power Flow.

Parameters:     

nBusHandle   [in/out] bus  handle

Return value:

1               success

-1              already at last bus

0               failure

Remarks: To get the first bus in the list, call this function with nBusHandle = 0

Example:

 

‘ Print bus list shorted by bus number

   nBusHnd& = 0

   While NextBusByNumber ( nBusHnd& ) > 0

      ' Print bus info

      If GetData( nBusHnd&, BUS_sName, sVal1$ ) = 0 Then GoTo HasError

      If GetData( nBusHnd&, BUS_dKVnorminal, dVal1# ) = 0 Then GoTo HasError

      If GetData( nBusHnd&, BUS_nNumber, nVal1& ) = 0 Then GoTo HasError

      If GetData( nBusHnd&, BUS_nArea, nVal2& ) = 0 Then GoTo HasError

      If GetData( nBusHnd&, BUS_nZone, nVal3& ) = 0 Then GoTo HasError

      Print #1, "BUS    ";  FullBusName( nBusHnd& );"  AREA=";nVal2&;"  ZONE="; nVal3&

   Wend