Este es mi codigo que quiero cambiar:
Código:
Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var app = new Form1(); var error = new Form2(); System.Net.HttpWebRequest req; System.Net.HttpWebResponse res; bool conected; try { req = (System.Net.HttpWebRequest) System.Net.WebRequest.Create(@"http://www.google.com"); res = (System.Net.HttpWebResponse)req.GetResponse(); req.Abort(); if (res.StatusCode == System.Net.HttpStatusCode.OK) { conected = true; } else { conected = false; } } catch// (System.Net.WebException e) { conected = false; } if (conected) { Application.Run(app); } else { error.ShowDialog(); }