//************************************** // Name: File Download // Description:This shows how to download a file in VB.NET and C# in only 2 lines of code! This is meant for BEGINNERS, but all are welcome to see it. I know this isn't much code, in fact, not event much of anything at all, but I was desperately trying to find a way to download a file with nonprintable characters (such as EXE's or DLL's), but when I tried using streams, it wouldn't come out quite right. Finally, I found a way to do this, so I am sharing it with everybody else in case someone need it also. // By: LinSparkUx7 (from psc cd) // // // Inputs:None // // Returns:None // //Assumes:Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows .NET Server family // //Side Effects:None //************************************** // '[Visual Basic] // '<ComVisible(True)> // 'Public Sub DownloadFile( _ // ' ByVal address As String, _ // ' ByVal fileName As String _ // ') Dim myWebClient As New System.Net.WebClient() myWebClient.DownloadFile("http://www.google.com/images/logo.gif", "C:\GoogleLogo.gif") 'The code above downloads the google log // o into the root directory of the C drive // . // '[C#] // '[ComVisible(true)] // 'public void DownloadFile( // ' string address, // ' string fileName // '); System.Net.WebClient myWebClient = new System.Net.WebClient(); myWebClient.DownloadFile("http://www.google.com/images/logo.gif","C:\GoogleLogo.gif"); 'The code above downloads the google log // o into the root directory of the C drive // .