In Visual Studio I used the following code:
private bool answer = true;
Private Buttonclick()
{
if()
{
answer =false
}
If you want to disable warnings, the error list contains a button that can stop them being shown in the list.

Additionally, a warning is just a warning. They won't stop your program from compiling, or even running. They may, however, declare in advance runtime errors and the like, so don't ignore them completely.