The black window is a console window started when the startup project has OutputType of Exe. To avoid this, change the OutputType to WinExe.