ลืมรหัสผ่าน
 ลงทะเบียน
ค้นหา
ดู: 922|ตอบกลับ: 3

Vb.net Button Click Update

[คัดลอกลิงก์]
โพสต์ 2019-7-12 16:42:40 | ดูโพสต์ทั้งหมด |โหมดอ่าน | Google Chrome 75.0.3770.100| Windows
แก้ไขครั้งสุดท้ายโดย dgsouce เมื่อ 2019-7-12 16:44
  1. Public Class Form1
  2.     Dim WebClient As New Net.WebClient
  3.     Public Sub CheckForUpdates()

  4.         Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://yourweb.com/Version.txt")
  5.         Dim response As System.Net.HttpWebResponse = request.GetResponse()

  6.         Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream())

  7.         Dim newestversion As String = sr.ReadToEnd()
  8.         Dim currentversion As String = Application.ProductVersion

  9.         If newestversion.Contains(currentversion) Then
  10.             Interaction.MsgBox("โปรแกรมของคุณล่าสุดแล้วครับ", MsgBoxStyle.Information, "Version Check")


  11.         Else
  12.             Interaction.MsgBox("มีซอร์ฟแวร์รุ่นใหม่ OK เพื่ออัพเดท", MsgBoxStyle.Exclamation, "Version Check")
  13.             Interaction.MsgBox("หลังจากอัพเดทเสร็จแล้ว ให้ลบโปรแกรมตัวเก่าออกทันที OK เริ่มดาวน์โหลด", MsgBoxStyle.Exclamation, "Version Check")
  14.             Try
  15.                 'Download App'
  16.                 WebClient.DownloadFile("http://yourweb.com/UpdateReset/autoupdate.exe", (Application.StartupPath & "\autoupdate1.exe"))
  17.                 Process.Start((Application.StartupPath & "\autoupdate1.exe"))
  18.                 Interaction.MsgBox("การอัพเดทเสร็จสิ้น", MsgBoxStyle.Information, "Update Version")

  19.                 Me.Close()
  20.             Catch ex As Exception
  21.             End Try

  22.         End If
  23.     End Sub
คัดลอกไปที่คลิปบอร์ด

Button1
  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2.         CheckForUpdates()

  3.     End Sub
คัดลอกไปที่คลิปบอร์ด


โพสต์ 2019-7-13 16:49:27 | ดูโพสต์ทั้งหมด | Google Chrome 75.0.3770.100| Windows 7
ขอบคุณครับ
โพสต์ 2020-3-22 16:13:40 | ดูโพสต์ทั้งหมด | Google Chrome 80.0.3987.149| Windows

ขอบคุณครับ
โพสต์ 2023-6-2 05:08:39 | ดูโพสต์ทั้งหมด | Google Chrome 113.0.0.0| Windows
ขอบคุณครับ
ขออภัย! คุณไม่ได้รับสิทธิ์ในการดำเนินการในส่วนนี้ กรุณาเลือกอย่างใดอย่างหนึ่ง เข้าสู่ระบบ | ลงทะเบียน

รายละเอียดเครดิต

ประวัติการแบน|Library IT ศูนย์รวมความรู้ทุกเรื่อง เพื่อป้องการอาชยากรรมทางไซเบอร์ไกล้ตัว

GMT+7, 2024-4-24 12:34 , Processed in 0.057533 second(s), 16 queries .

Powered by Discuz! X3.5, Rev.8

© 2001-2024 Discuz! Team.

ตอบกระทู้ ขึ้นไปด้านบน ไปที่หน้ารายการกระทู้