COM object EvSpeciesCollection

EvApplication > EvFileCollection > EvFile > EvFileProperties > EvSpeciesCollection

 

View the COM map and the COM summary.

The EvSpeciesCollection object accesses information about the set of species under the  Species section of the Classes page of the EV File Properties dialog box. A species is an item of the EvSpeciesCollection and can be accessed via the EvFileProperties.Species property.

EvSpeciesCollection methods and properties:

Add
Count
Delete

FindByName
Item

 

Description

Add

Add (string Name)

Summary

Add the named species to the EvSpeciesCollection.

Parameters
  • Name
  • The name of the species to add.
Example
'List all the variables after Dim statement
Dim EvApp, EvFile, SpeciesName1, SpeciesName2, SpeciesName3, aFishSpecies, aFishSpeciesName, bFishSpecies, bFishSpeciesName, MsgBoxOutput

'Set statement required for non-VBScript data types
Set EvApp = CreateObject("EchoviewCom.EvApplication")
Set EvFile = EvApp.OpenFile("YourEVFileURL.EV")

'Specify some species names
SpeciesName1 = "Goldfish"
SpeciesName2 = "Silverfish"
SpeciesName3 = "ByCatch"

'Add the species to the Species Collection
EvFile.Properties.Species.Add(SpeciesName1)
EvFile.Properties.Species.Add(SpeciesName2)
EvFile.Properties.Species.Add(SpeciesName3)

'Check that count is larger than 3, get the 2nd last species by item index and delete it
If EvFile.Properties.Species.Count>3 Then
Set aFishSpecies = EvFile.Properties.Species.Item(EvFile.Properties.Species.Count-2)
aFishSpeciesName = aFishSpecies.Name
MsgBoxOutput = MsgBox(aFishSpeciesName,,"EvSpeciesCollectionTesting")
Else
MsgBoxOutput = MsgBox(EvFile.Properties.Species.Count,,"Number of Species")
End if
If EvFile.Properties.Species.Delete(aFishSpecies) Then
MsgBoxOutput = MsgBox(aFishSpeciesName,,"Species Deleted")
Else
MsgBox "Delete failed"
End If

'Try to find a species based on name and delete that species
Set bFishSpecies = EvFile.Properties.Species.FindByName(SpeciesName3)
if bFishSpecies Is Nothing Then
MsgBoxOutput = MsgBox(SpeciesName3,,"Species not found")
Else 
MsgBoxOutput = MsgBox(SpeciesName3,,"Species found!")
bFishSpeciesName = bFishSpecies.Name
End If
if EvFile.Properties.Species.Delete(bFishSpecies) Then
MsgBoxOutput = MsgBox(bFishSpeciesName,,"Species Deleted")
Else
MsgBox "Delete failed"
End If
EvFile.Save

Count

(read-only) integer Count

Summary

Get the number of species in the EvSpeciesCollection.

Example

See EvSpeciesCollection.Add example

Delete

boolean Delete (EvSpecies Species);

Summary

Remove the species specified by the EvSpecies object.

Parameters
  • Species
  • The species to remove.
Example

See EvSpeciesCollection.Add example

FindByName

FindByName (string Name)

Summary

Find the specified species item in the EvSpeciesCollection.

Parameters
  • Path
  • The name of the species.
Example

See EvSpeciesCollection.Add example

 

Item

(read-only) Item[]

Summary

Gives access to a specific species by index. Indexes are zero-based, so valid indexes are from 0 to Count-1. The result is a EvSpecies object.

Item is the default property for this interface. The examples on the EvFileCollection page show several ways to use the Item property.

See also

Scripting with COM objects
COM object hierarchy
EvFileProperties object