How To Check for Program updates in C#

Part 1 :

Hi, have a good day.

This simple class will help to check for your application updates, and it’s very simple.

First create a text file on your website “myapp-pro.txt” for example:
and add the following content to it :


Notice that each properties is  separated with “;”.

C# Class :

    class CheckUpdates
        public string appname = string.Empty;
        public Version version = new Version();
        public string newdownloadlink = string.Empty;

        public CheckUpdates(string uri)
            WebClient client = new WebClient();
            string content = string.Empty;
            Stream stream;

                stream = client.OpenRead(uri);
                StreamReader reader = new StreamReader(stream);
                content = reader.ReadToEnd();
            catch (WebException ex)

            string[] strContent = content.Split(';');
            if (strContent.Length != 3)
                MessageBox.Show("text file must be in this format \"appname;version;newurl\"");

            appname = strContent[0];
            version = new Version(strContent[1]);
            newdownloadlink = strContent[2];

Usage Example :

 CheckUpdates checkupdate = new CheckUpdates("");
            MessageBox.Show(checkupdate.appname + "\r\n" + checkupdate.version.ToString() + "\r\n" + checkupdate.newdownloadlink);

In the Next post I will show how to update your Application Automatically With C# :)


Leave a Reply

Your email address will not be published.