การเรียกใช้งาน Web Services ใน Visual Studio 2017

winform call web services

สร้างโปรเจ็กส์

File > New > Project…
เลือกโปรเจ็กส์แบบ Windows Classic Desktop > Windows Forms App (.NET Framework)
ตั้งชื่อโปรเจ็กส์ JackWinForm

เพิ่ม Web Services References

คลิกขวาที่ References > Add Service References…
ใส่ url ของ Web Services เช่น http://localhost:62668/MyWebService.asmx กด Go
เลือก MyWebService > MyWebServiceSoap
ตั้งชื่อ MyServiceReference

ที่ Form1.cs

เพิ่ม Textbox, Button และ Label
เพิมอีเวนต์ให้ Button