Method and apparatus for controlling an electronic device. The method comprises pointing using a pointing device at a link device in order to create a wireless data transmission connection between the pointing device and the link device, and transferring identification data between the pointing device and the link device along the created data transmission connection. Next, a first association between the identification data of the pointing device and the identification data of the link device is formed. After this, a second association between the identification data of the user of the pointing device and the identification data device to be controlled communicating with the link device is formed.