Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
Public Sub CheckForUpdates()
       Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://192.168.0.254/Vandella/Update/Version.txt")
       Dim response As System.Net.HttpWebResponse = request.GetResponse()
       Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())
       Dim newestversion As String = sr.ReadToEnd()

       Dim currentversion As String = System.Diagnostics.FileVersionInfo.GetVersionInfo(Application.StartupPath & "\test.exe")

       If newestversion.Contains(currentversion) Then
           MsgBox("You are using the latest version!")
           Me.Hide()

           Dim MainForm As New AngelZoneDB.AngelZoneDB
           MainForm.Show()


       Else

           MsgBox("There is a new version on the website, Press 'Ok' to download", MsgBoxStyle.OkOnly, "Update Found!")

           UpdateContinue()

       End If


Error comes up, when i debug

System.Diagnostics.FileVersionInfo cannot be converted to string

I want something like that? Sorry about my english, i dont know how to fix

What I have tried:

It's working if i put this code in

currentversion As String = Application.ProductVersion

but i want to get the ProductVersion from my exe file
Posted
Updated 30-Apr-16 11:08am

1 solution

First of all, you need to stop viewing all data as strings. Also, you need elementary skills of reading at least original MSDN documentation, which is extremely clear.

It can be
C#
System.Diagnostics.FileVersionInfo info = System.Diagnostics.FileVersionInfo.GetVersionInfo(fileName);

Please see:
FileVersionInfo.GetVersionInfo Method (String) (System.Diagnostics)[^],
FileVersionInfo Class (System.Diagnostics)[^].

As to "get another file version", there is no any predefined or standardized method. Some file systems have embedded file versioning systems, but hardly any of the system you ever face with. There is nothing like that in Web standards. If a particular Web site or application delivers different versions of something, it's totally up to these applications. You have to learn particular interface provided by such application, or learn how to do it via Web scraping.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900