Examples with Message Boxes and a Loop


This is a simple  example for Windows Form Application. I programmed it to display a small form in the center of the screen like this.

Which makes it look like a updater of sorts for a corporation which if you click on the install button it uses a loop to redisplay a message box like this. 

I used the simple infinite loop: 

private void button1_Click(object sender, EventArgs e)


while (true) { MessageBox.Show(" Sorry the file: Application Archiving and Error Help is invalid!\n\n We suggest that you contact Microsoft and report this serious error!"); }



A warning to you that is an infinite loop meaning if you run that in any thing but the C# debugger you'll have to close it by Pressing and holding Ctrl. + Alt. + Delete, and when the Task Manager shows up, you select the process called NPDR Corp.exe and end it.

I recommend reading Head First C#