1 / 18

Visual Basic 6

Visual Basic 6. By Samaporn Yendee. Visual Basic programming. เป็นภาษาระดับ Industrial Strength คือ นำมาพัฒนาเป็นโปรแกรมที่ใช้งานได้จริงในธุรกิจต่าง ๆ และเป็นภาษาที่แพร่หลายที่สุดในโลก ประกอบด้วย 2 ส่วน Programming environment

Télécharger la présentation

Visual Basic 6

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Visual Basic 6 By Samaporn Yendee VB6

  2. Visual Basic programming • เป็นภาษาระดับ Industrial Strength คือ นำมาพัฒนาเป็นโปรแกรมที่ใช้งานได้จริงในธุรกิจต่าง ๆ และเป็นภาษาที่แพร่หลายที่สุดในโลก • ประกอบด้วย 2 ส่วน • Programming environment • เป็นส่วนที่ช่วยให้สร้างโปรแกรมง่ายขึ้น เช่น กล่องเครื่องมือ (Tool Box) ซึ่งถือเป็นส่วนสำคัญในการออกแบบโปรแกรม โดยเฉพาะส่วนจอภาพ (user interface) • Language constructs • เป็นส่วนของรหัสคำสั่ง นอกจากนั้นยังมีกลไกในการแบ่งโปรแกรมออกเป็นโปรแกรมย่อย ซึ่งเรียกว่า Subroutine Procedure และ Function Procedure VB6

  3. เริ่มต้นพัฒนาโปรแกรม • Start  Program  Microsoft visual studio 6.0  Visual Basic 6.0 New เลือกรูปแบบของงานใหม่ Existing เลือกรูปแบบของงานที่มีอยู่แล้ว Recent เลือกรูปแบบของงานครั้งล่าสุด VB6

  4. เริ่มต้นกับ Visual Basic 6.0 VB6

  5. เริ่มต้นกับ Visual Basic 6.0

  6. เมื่อคลิก open • สภาวะแวดล้อมในการพัฒนาโปรแกรม • Menu bar • Tool bar • Form window • Tools Box • Form layout • Project explorer • Code window VB6

  7. VB6

  8. เครื่องมือที่สำคัญๆ Tool Box VB6

  9. Form layout windows กำหนดตำแหน่งที่จะให้แสดงผลการทำงานบนจอภาพ โดย drag & drop VB6

  10. Event-Driven Programming • โปรแกรมบน windows จะเป็นโปรแกรมที่สามารถทำงานพร้อมกันหลาย ๆ งาน (Multitasking) ได้ และทำได้หลายคน (Multi Users) ดังนั้นโปรแกรมจึงต้องมีความสามารถในการดำเนินการกับเหตุการณ์ (Event) แต่ละเหตุการณ์ได้ เช่น การกดคีย์ การคลิกเม้าส์ ฯลฯ จึงจำเป็นต้องมีโปรแกรมย่อยมาดูแลแต่ละเหตุการณ์ นั่นคือ เหตุการณ์ที่เกิดขึ้นจะเป็นตัวกระตุ้น (driven) ให้โปรแกรมทำงาน จึงเรียกเทคนิคการเขียนโปรแกรมนี้ ว่า Event-Driven Programming VB6

  11. Control & Event • Control (จาก Tools box) แต่ละ control จะรับรู้เหตุการณ์ได้จำนวนหนึ่ง เช่น Text box สามารถตอบสนองต่อเหตุการณ์ change, click, dbclick etc ถ้าเราเขียนโปรแกรมย่อยไว้จัดการกับเหตุการณ์ click ไว้ เมื่อเกิดการ click ที่ Text box นั้น โปรแกรมจะประมวลผลทันที • เมื่อกำหนด control ใด ๆ ให้กับ form แล้ว ต้องกำหนดคุณสมบัติ (Properties) ของ control นั้นด้วย VB6

  12. ตัวอย่าง properties ของ text box ที่ชื่อ text1 VB6

  13. การตั้งชื่อ Object • ชื่อควรสื่อความหมาย • ความยาวไม่เกิน 256 ตัวอักษร • ห้ามขึ้นต้นอักษรพิเศษ เช่น $, # และไม่ซ้ำคำสงวน • ห้ามมีที่ว่างระหว่างชื่อ • สามารถใช้ Prefix หน้าชื่อ object ช่วยให้ทราบชนิดของ Object ง่ายในการจดจำ VB6

  14. Prefix • Control • Combo box • Check box • Directory list box • Drive list box • File list box • Form • Grid • Horizontal scrollbar VB6 • Prefix • cbo • chk • dir • drv • fil • frm • grd • hsb

  15. Running Application • ทดสอบโปรแกรมโดยกด F5 หรือ Start ใน Menu หรือ คลิกที่ไอคอน เพื่อตรวจดูข้อบกพร่องของโปรแกรม • Compile โปรแกรมให้เป็น Executable โปแกรมที่สามารถแจกจ่ายนำไปทำงานที่อื่น ๆ ได้ VB6

  16. สรุปขั้นตอนการสร้าง Application • Start Visual Basic • User interface design (Control used) • Properties setting • Procedure writing • Program testing • Make executable program (Compiled) • Make application (Application Setup wizard) • Documentation VB6

  17. ปัญหาที่ 1 • จงเขียนโปรแกรมเพื่อแสดงข้อความบนจอภาพ โดยให้ข้อความวิ่งจากด้านขวามือไปด้ายซ้ายมือ จนกว่าจะคลิกที่ปุ่ม stop จึงจะหยุดวิ่ง และรอสักครู่ก็หยุดการทำงานของโปรแกรม VB6

  18. VB6

More Related