05-04-2011, 03:45 AM
Hallo,
I try to compare the version of my program with the version-number given by a PHP Serverapplication, both are Strings like x.y.z.a
But comparison with "<" does not work.
My code is like this:
and this:
Seems as if the comparison of "1.0.0.0" and "1.0.0.1" with character "<" does not work.
Any idea what's going wrong here??
I try to compare the version of my program with the version-number given by a PHP Serverapplication, both are Strings like x.y.z.a
But comparison with "<" does not work.
My code is like this:
Code:
Public Function versionCheck(ByVal sURL As String) As String
Dim tmp As String = ""
' Prüft, ob die angegebene URL erreichbar ist
Try
Dim uri As New Uri(sURL)
If (uri.Scheme = uri.UriSchemeHttp) Then
Dim request As HttpWebRequest = HttpWebRequest.Create(uri)
request.Method = WebRequestMethods.Http.Get
Dim response As HttpWebResponse = request.GetResponse()
Dim reader As New StreamReader(response.GetResponseStream())
tmp = reader.ReadToEnd()
response.Close()
End If
Return tmp
Catch ex As Exception
log("myApp, version Check", ex.Message)
' URL not reached
Return ex.Message
End Try
End Function
and this:
Code:
Dim infoString As String
Dim actualVersion As String
Try
If (MC.a2UseLocalhost = True) Then
actualVersion = MC.versionCheck("http://localhost/test-version.php")
Else
actualVersion = MC.versionCheck("http://ww.mytestserver.com/test-version.php")
End If
infoString = "Your Version: " & My.Application.Info.Version.ToString & vbCrLf & "Actual Version: " & actualVersion
' following does not work
If (My.Application.Info.Version.ToString < actualVersion) Then
infoString &= "Update needed!" & vbCrLf
Else
infoString &= "Programversion OK!" & vbCrLf
End If
MessageBox.Show(infoString)
Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try
Seems as if the comparison of "1.0.0.0" and "1.0.0.1" with character "<" does not work.
Any idea what's going wrong here??