Question: I'm starting with Visual Basic and use Visual Studio 2012 and trying to make a tool for renaming a group of files.

How it shoul be:

1- With the "Select Files" button, I can choose the files and they are listed in the ListBox

2- "Old value" is a textbox and is the value to be changed in the filename. For example: fff

3- "New value" is a textbox and is the new value that should replace the old. For example: zzz

4- Rename is a button to start the process.

To rename only one file it's not a problem.
But how to rename all the files from the ListBox which are containing the Oldvalue ?

Can you please help me!

Thanks

Answer: 
First, you need to prevent your application window from closing when you hit the "close window" button. Assuming, that you use `QMainWindow`:

```
class MainWindow : public QMainWindow
{
    // .. constructors, etc.
    // ..
protected:
    void closeEvent(QCloseEvent *)
    {
        // Do not close, but hide the window.
        hide();
    }
};

```

Qt has the dedicated class to handle the task bar icons - `QSystemTrayIcon`. So, the simple application would look like:

```
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    MainWindow mw;
    QSystemTrayIcon tray; // needs an icon.

    // Show the main window when user activates the tray icon.
    QObject::connect(&tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                     &mw, SLOT(show()));
    tray.show();

    return app.exec();
}

```
This should be helpful: 

```
 void setQuitOnLastWindowClosed(bool quit)

```