[Overview][Resource strings][Constants][Types][Classes][Index] | Reference for unit 'resource' (#fcl-res)

# TResources.AddAutoID

Adds a resource and gives it a new autogenerated name

## Declaration

Source position: resource.pp line 249

`public function TResources.AddAutoID(`
`aResource: TAbstractResource`
`):TResID;`

## Arguments

`aResource` |  | The resource to add

## Function result

The autogenerated ID of the added resource

## Description

This method tries to find a spare ID to use as a name for the given resource, assigns it to the resource, and adds it.

This method is useful when the name of the resource is not important. E.g. a group resource doesn't care about the names of its sub-resources, so it could use this method to ensure that its sub-resources don't clash with names of other sub-resources of the same type.

## Errors

If there are no more free IDs for the resource type of the given resource (that is, when the number of resources of the same type of aResource with an ID name is equal to 65536) an ENoMoreFreeIDsException exception is raised.

## See also

TResources.Add |  | Adds a resource