help with downloading please

cpgames

Member
Joined
Sep 14, 2011
Messages
14
Programming Experience
Beginner
Hello when i get my program to download somthing it works but i need to save it in app data so i have got a cupple of lines of code that get the username but when i add it it to the code it doesent work please help my code he hear


VB.NET:
Dim un As String
        un = System.Environment.UserName
        TextBox1.Text = un

        Dim os As String
        os = My.Computer.Info.OSFullName
        TextBox2.Text = os


        If os = "Windows Xp" Then My.Computer.Network.DownloadFile _
("http://www.cpgames.co.uk/minecraft.jar", _
    "C:\Documents and Settings\un\application data\minecraft.jar")

i no i only have half an if stament i couldent get the bit for vista and seven to work


thanks charlie
 
You don't need to care what the OS is. Use Environment.GetFolderPath or My.Computer.FileSystem.SpecialDirectories to get standard folder paths and it will work the same for all OSes.
 
Back
Top