# Updating Hotkeys

You can update hotkeys using the `Update()` method. It works the same way as *string replacement* where you provide the current string and its replacement option:

```
hkl.Update(hotkey1, new Hotkey(Keys.Control | Keys.Alt, Keys.T));
```

Hotkey updates can occur even when the application is running. **However**, something important you need to note is that **always use variables to store hotkeys** since in this way, whenever an update to the hotkey occurs, it will automagically be detected in the `HotkeyPressed` event.

Here's what I mean:

```
Hotkey hotkey3 = new Hotkey(Keys.Control | Keys.Alt, Keys.T);

// To update our hotkey, simply pass the current hotkey with 
// a 'ref' keyword to the variable and its replacement.
hkl.Update(ref hotkey3, new Hotkey(Keys.Alt, Keys.T);
```

This will ensure that both the hotkey and its variable have been updated to reflect the changes made. This design is especially handy if your application saves *user settings* after update.

Here's another classical example of updating a hotkey:

```
Hotkey hotkey1 = new Hotkey(Keys.Control | Keys.Alt, Keys.T);
Hotkey hotkey2 = new Hotkey(Keys.Alt, Keys.T);

// Once we reference the variable hotkey1, this will 
// update the hotkey and listen for its key-presses.
hkl.Update(ref hotkey1, hotkey2);
```
