1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University...
-
Upload
christian-shaw -
Category
Documents
-
view
215 -
download
0
Transcript of 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University...
![Page 1: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/1.jpg)
1
Workshop 4 (B):Visual Basic Test Project
Mahidol University
June 13, 2008
Paul EvensonUniversity of DelawareBartol Research Institute
![Page 2: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/2.jpg)
2
Starting a New Project
• Make an empty folder to hold your project
• Select the type of project and press Open
![Page 3: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/3.jpg)
3
Select Your Options
• Critical Options:• Editor: Require Variable Declaration• Environment: Prompt to Save Changes
![Page 4: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/4.jpg)
4
Select Names and Components
• Name the project and the initial form• Be sure the controls you need are loaded• Save everything in your new directory• Examine files with text editor
![Page 5: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/5.jpg)
5
Place Control and Adjust Properties
![Page 6: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/6.jpg)
6
Run the Program – It Works!
![Page 7: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/7.jpg)
7
Setting Control Properties
• Note that the “Backcolor” property is a long integer• At “Design Time” you can set it with a “drop down” menu
![Page 8: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/8.jpg)
8
Double Click a Control to Open the Code Window for Its Events
• Any code you add here is executed every time the event occurs• Here we add the instruction to change the backcolor to green• Now run the program again
![Page 9: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/9.jpg)
9
Now Try More Elaborate Code
![Page 10: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/10.jpg)
10
Making Your Execute File
You can now run this like any other program
![Page 11: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/11.jpg)
11
Adding a “Pure Code” Module
This type of module is the proper way to include subroutines that can be called from anywhere in your program
![Page 12: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/12.jpg)
12
Towards Cleaner Code…
• Define the variables as Global in the code module
• Set them only once in the “Load” event on the main form
• They are now available to anyone
• If you don’t like the shade of red, you can change it once, and it will change everywhere
![Page 13: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/13.jpg)
13
Add Another Label Control
![Page 14: 1 Workshop 4 (B): Visual Basic Test Project Mahidol University June 13, 2008 Paul Evenson University of Delaware Bartol Research Institute.](https://reader031.fdocuments.in/reader031/viewer/2022012922/56649e665503460f94b613b0/html5/thumbnails/14.jpg)
14
Adding the Communications