01.
Public
Class
Form1
02.
03.
Private
Sub
Form1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
04.
05.
Timer1.Enabled =
True
06.
07.
End
Sub
08.
Public
Sub
CheckForUpdates()
09.
11.
12.
Dim
response
As
System.Net.HttpWebResponse = request.GetResponse()
13.
Dim
sr
As
System.IO.StreamReader =
New
System.IO.StreamReader(response.GetResponseStream())
14.
Dim
newestversion
As
String
= sr.ReadToEnd()
15.
Dim
currentversion
As
String
= Application.ProductVersion
16.
If
newestversion.Contains(currentversion)
Then
17.
18.
MsgBox(
"You are up todate :D"
)
19.
Label1.Text =
"เวอร์ชั่นล่าสุด"
20.
Label1.ForeColor = Color.Green
21.
Button1.Enabled =
True
22.
23.
Else
24.
If
MsgBox(
"A New Version 'xxx.exe updatenow"
, MsgBoxStyle.YesNo,
""
) = MsgBoxResult.Yes
Then
25.
26.
System.Diagnostics.Process.Start(
" xxx.exe << ตรงนี้ัยังไม่ได้ใส่ครับอยากให้มันแทนที่ตัวEXeเก่า "
)
27.
End
If
28.
End
If
29.
30.
End
Sub
31.
32.
Private
Sub
Timer1_Tick(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
Timer1.Tick
33.
34.
Button1.Enabled =
False
35.
Timer1.Enabled =
False
36.
CheckForUpdates()
37.
End
Sub
38.
End
Class