Visual Basic - Program Update

Odigo

Gawd
Joined
Apr 22, 2002
Messages
805
I have a small application that I want to compare a local text file to a server's text file for updates and display a message saying an update is available. Code help appreciated :)
 
LOL, it's for a small class program, won't be used anywhere else.
 
First, read this: http://hardforum.com/showthread.php?t=810619

So, unless you post what you have so far, I doubt you'll get much help.

What about adding a version number in the first line of the txt file and compare that. If it's greater, then it is a newer version.

Right now I have a VB application for my database. It's real simple with a top menu and forms with data-grids. Only programming that I really had to do is the onclick shows, and I made one if/then show form for a password text box. I was looking for extra stuff that I could add. I thought a check version would be pretty neat, I just don't know how to go about checking a text file.
 
Like Ur Mom said, use your noggin first and ask specific questions that you need help with.
 
Like Ur Mom said, use your noggin first and ask specific questions that you need help with.

I thought I just did? I need to know how to check a local text file and compare a value with one that is not local. I'm looking for code examples, as I'm new to programming and I don't know how to go about doing this. Seeing as my responses thus far have not been any help whatsoever, it's pretty apparent I came to the wrong place.
 
Go to google and search for

vb compare file

That should start you off. We aren't trying to be hard asses. It's like the saying "Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime". In other words there's many smart people here who are willing to help but from reading the thread so far you don't seem willing to even do basic research. Please correct me if I'm wrong about that.
 
I thought I just did? I need to know how to check a local text file and compare a value with one that is not local. I'm looking for code examples, as I'm new to programming and I don't know how to go about doing this. Seeing as my responses thus far have not been any help whatsoever, it's pretty apparent I came to the wrong place.
We can't figure out how to help you if you don't tell us what you've tried so far. If you're asking us for help without having tried to write it, you shouldn't be surprised when people here aren't in the mood to be helpful.
 
Actually I did research and couldn't find anything. Checking youtube I found this, works well.

Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://h1.+++++++++++/TeachMeComputer/currentversion.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 = Application.ProductVersion

If newestversion.Contains(currentversion) Then
MessageBox.Show("You have the current version")
Else
MessageBox.Show("Newer version available")
End If
End Sub

End Class
 
I don't know vb so I can't help with code, but easiest way would be to download the file, then read both files char by char at the same time (ex: have two separate streams open and just read a char from both in a loop), if you hit a single instance where both chars are different, then just stop and return true, otherwise keep going until you reach end of file, and return false. (true = new update, false = none).
 
I don't know vb so I can't help with code, but easiest way would be to download the file, then read both files char by char at the same time (ex: have two separate streams open and just read a char from both in a loop), if you hit a single instance where both chars are different, then just stop and return true, otherwise keep going until you reach end of file, and return false. (true = new update, false = none).
Different is not the same as newer. What if the local file is newer? The same flaw exists in that Youtube code.
 
Different is not the same as newer. What if the local file is newer? The same flaw exists in that Youtube code.

Ah, ideally it wouldn't be used for a commercial app. For my little crappy project it gets the job done, lol.
 
Back
Top