1. Trang chủ
  2. » Giáo án - Bài giảng

Giáo án - Bài giảng: Giáo trình đào tạo visual basic FPT

39 447 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 39
Dung lượng 343,39 KB

Nội dung

Requested Range Not Satisfiable None of the range-specifier values in the Range request-header field overlap the current extent of the selected resource Apache/2.2.15 (CentOS) Server at tailieuhoctap.vn Port 80 i%j%(タ)タ)タ)タ)タ)タ)タ)タ)タ)タ)タ)タ)F/?￾//000000000?￾?￾[タ ?￾タタ?￾bjbj タ?￾ タΐΐR?￾?￾タUUタ タ タ t!!!?￾?￾ タy5?￾!タ?￾MN タ dLWdWdmdl タ,タタ\タ 0xxxxxxx$タタタタV7xqタ ?￾タ k|l?￾?￾7xUUWdmdタタ.タタタ?￾H U?￾ Wdタ mdxタ?￾xタタタG C ^imd@タ タ?￾?￾!?￾%S$?￾֎HタIT?￾タ?￾< タDiタタ 5i?￾H タタ?￾タ タタ?￾$ ?￾?￾H タ H タ H タ 7x7xR?￾H H タ H タ H タタ?￾?￾?￾?￾タH タ H タ H タ H タ H タ H タ H タ H タ H タ : M?￾c l?￾c TOC \o "1-3" M?￾c l?￾c PAGEREF _Toc6394115 \h L?￾m quen v?￾i visual basic 6.0 PAGEREF _Toc6394116 \h 2.1 X?￾y d?￾ng ?￾ng d?￾ng ban タu PAGEREF _Toc6394117 \h 2.1.1 Viタt ?￾ ng d?￾ng ban タu PAGEREF _Toc6394118 \h 2.1.2 X?￾y d?￾ng t?￾nh nng Calendar PAGEREF _Toc6394119 \h 2.1.3 Th?￾m t?￾nh nng Clock PAGEREF _Toc6394120 \h 11 2.2 C?￾c t?￾nh nng m?￾i Visual basic 6.0 PAGEREF _Toc6394121 \h 11 2.2.1 Kh?￾i qu?￾t v タn t タt v?￾ Visual basic 6.0 PAGEREF _Toc6394122 \h 11 2.2.2 Khai th?￾c thタ m タnh c?￾a c?￾c i?￾u khi?￾n m?￾ r?￾ng PAGEREF _Toc6394123 \h 12 2.3 L?￾m vi?￾c v?￾i m?￾i tr タ?￾ng l タp tr?￾nh Visual basic PAGEREF _Toc6394124 \h 12 2.3.1 T?￾m hi?￾u c?￾c ph タn c?￾a IDE PAGEREF _Toc6394125 \h 12 2.3.2 Th?￾m v?￾ xo?￾ c?￾c c?￾ ng c?￾ IDE c?￾a Visual basic PAGEREF _Toc6394126 \h 13 2.3.3 Th?￾m c?￾c i?￾u khi?￾n v?￾o h?￾p c?￾ng c?￾ PAGEREF _Toc6394127 \h 14 2.3.4 ?￾nh h タ?￾ng th?￾ng qua c?￾a s?￾ form v?￾ code PAGEREF _Toc6394128 \h 14 2.3.5 Qu タn l?￾ ?￾ng d?￾ng v?￾i project explorer PAGEREF _Toc6394129 \h 14 2.3.6 C?￾a s?￾ properties PAGEREF _Toc6394130 \h 14 2.3.7 Hi?￾n th?￾ IDE PAGEREF _Toc6394131 \h 14 2.3.8 Tr?￾ gi?￾p PAGEREF _Toc6394132 \h 15 T?￾m hi?￾u Visual basic PAGEREF _Toc6394133 \h 16 3.1 Thu?￾c t?￾nh ph タタng th?￾c v?￾ s?￾ ki?￾n PAGEREF _Toc6394134 \h 16 3.1.1 ?￾i t タ?￾ng PAGEREF _Toc6394135 \h 16 3.1.2 Thu?￾c t?￾nh PAGEREF _Toc6394136 \h 16 3.1.3 Ph タタng th?￾c PAGEREF _Toc6394137 \h 17 3.1.4 S?￾ ki?￾n PAGEREF _Toc6394138 \h 18 3.1.5 M?￾i quan h?￾ gi?￾a ph タタng th?￾c, thu?￾c t?￾nh v?￾ s?￾ ki?￾n PAGEREF _Toc6394139 \h 18 3.1.6 C?￾a s?￾ Properties PAGEREF _Toc6394140 \h 19 3.1.7 Viタt ch タタng tr?￾nh s?￾ d?￾ng thu?￾c t?￾nh, ph タタng th?￾c v?￾ s?￾ ki?￾n PAGEREF _Toc6394141 \h 20 3.2 L?￾m vi?￾c v?￾i m?￾t ?￾ ?￾n PAGEREF _Toc6394142 \h 24 3.2.1 ?￾nh ngh)a PAGEREF _Toc6394143 \h 24 3.2.2 C?￾a s?￾ Project Explorer PAGEREF _Toc6394144 \h 25 3.2.3 T タo ?￾ ?￾n PAGEREF _Toc6394145 \h 25 3.2.4 ?￾i thu?￾c t?￾nh ?￾ ?￾n PAGEREF _Toc6394146 \h 25 3.2.5 L タu v?￾ タt t?￾n ?￾ ?￾n PAGEREF _Toc6394147 \h 26 3.2.6 M?￾ ?￾ ?￾n c?￾ s タn PAGEREF _Toc6394148 \h 26 3.2.7 Th?￾m xo?￾ v?￾ l タu t タp tin ?￾ ?￾n PAGEREF _Toc6394149 \h 27 3.2.8 Th?￾m i?￾u khi?￾n v?￾o ?￾ ?￾n PAGEREF _Toc6394150 \h 29 3.2.9 T タo t?￾p tin EXE PAGEREF _Toc6394151 \h 30 3.2.10 S?￾a ?￾i thu?￾c t?￾nh ?￾ ?￾n PAGEREF _Toc6394152 \h 31 3.3 L?￾m vi?￾c v?￾i nhi?￾u ?￾ ?￾n PAGEREF _Toc6394153 \h 32 3.3.1 S?￾ d?￾ng Project Group PAGEREF _Toc6394154 \h 32 3.3.2 Th?￾m ?￾ ?￾n v?￾o nh?￾m ?￾ ?￾n PAGEREF _Toc6394155 \h 32 3.3.3 Xo?￾ ?￾ ?￾n nh?￾m ?￾ ?￾n PAGEREF _Toc6394156 \h 33 L?￾m vi?￾c v?￾i c?￾c i?￾u khi?￾n PAGEREF _Toc6394157 \h 34 4.1 C?￾c lo タi i?￾u khi?￾n PAGEREF _Toc6394158 \h 34 4.1.1 Thao t?￾c v?￾i i?￾u khi?￾n PAGEREF _Toc6394159 \h 34 4.2 C?￾c i?￾u khi?￾n n?￾i t タi PAGEREF _Toc6394160 \h 37 4.2.1 N?￾t l?￾nh PAGEREF _Toc6394161 \h 37 4.2.2 H?￾p b タn PAGEREF _Toc6394162 \h 38 4.2.3 i?￾u khi?￾n cu?￾n PAGEREF _Toc6394163 \h 38 4.2.4 i?￾u khi?￾ n Timer PAGEREF _Toc6394164 \h 39 4.2.5 i?￾u khi?￾n nh?￾n PAGEREF _Toc6394165 \h 39 4.2.6 Checkbox: EMBED PBrush PAGEREF _Toc6394166 \h 39 4.2.7 M?￾t s?￾ thu?￾c tinh th?￾ng d?￾ng: PAGEREF _Toc6394167 \h 39 4.2.8 4.2.9 H?￾p danh s?￾ch (Listbox) PAGEREF _Toc6394168 \h 39 4.3 C?￾c i?￾u khi?￾n M ?￾i PAGEREF _Toc6394169 \h 40 Nh タp m?￾n l タp tr?￾nh PAGEREF _Toc6394170 \h 41 5.1 Chu タn l タp tr?￾nh (Coding convention) PAGEREF _Toc6394171 \h 41 5.1.1 Coding conventions PAGEREF _Toc6394172 \h 41 5.1.2 Form design standard PAGEREF _Toc6394173 \h 46 5.1.3 Report design standard (for Crystal Report) PAGEREF _Toc6394174 \h 49 5.1.4 Database design standards PAGEREF _Toc6394175 \h 50 5.2 Thiタt kタ tr タ?￾c viタt ch タタng tr?￾nh PAGEREF _Toc6394176 \h 51 5.3 C?￾c thao t?￾c th?￾ng d?￾ng c?￾a s?￾ Code PAGEREF _Toc6394177 \h 51 5.3.1 So タn th タo Code PAGEREF _Toc6394178 \h 51 5.3.2 M?￾t s?￾ ch?￾c nng t?￾ ?￾ng PAGEREF _Toc6394179 \h 52 5.4 Biタn h タng v?￾ c?￾c ki?￾u d?￾ li?￾u PAGEREF _Toc6394180 \h 52 5.4.1 Khai b?￾o biタn PAGEREF _Toc6394181 \h 52 5.4.2 Khai b?￾o ng タm PAGEREF _Toc6394182 \h 52 5.4.3 Khai b?￾o t タ?￾ng minh PAGEREF _Toc6394183 \h 53 5.4.4 Khai b?￾o biタn Static PAGEREF _Toc6394184 \h 53 5.4.5 H タng PAGEREF _Toc6394185 \h 53 5.5 H?￾m v?￾ th?￾ t?￾c PAGEREF _Toc6394186 \h 60 5.6 C タu tr?￾c i?￾u khi?￾ n PAGEREF _Toc6394187 \h 61 5.6.1 C タu tr?￾c ch?￾n PAGEREF _Toc6394188 \h 61 5.6.2 C タu tr?￾c l タp PAGEREF _Toc6394189 \h 62 5.6.3 L?￾m vi?￾c v?￾i c タu tr?￾c PAGEREF _Toc6394190 \h 63 5.7 G?￾ r?￾i ch タタng tr?￾nh PAGEREF _Toc6394191 \h 63 5.7.1 M?￾t s?￾ gi タi ph?￾p gi タm l?￾i PAGEREF _Toc6394192 \h 63 5.7.2 G?￾ r?￾i PAGEREF _Toc6394193 \h 64 5.8 B タy l?￾i PAGEREF _Toc6394194 \h 65 5.8.1 L?￾nh On Error PAGEREF _Toc6394195 \h 65 5.8.2 Kタt th?￾c b タy l?￾i PAGEREF _Toc6394196 \h 65 L タp tr?￾nh x?￾ l?￾ giao di?￾n PAGEREF _Toc6394197 \h 66 6.1 Menu PAGEREF _Toc6394198 \h 66 6.1.1 D?￾ng tr?￾nh so タn th タo menu ?￾ t タo menu PAGEREF _Toc6394199 \h 66 6.1.2 Viタt ch タタng tr?￾nh i?￾u khi?￾n menu PAGEREF _Toc6394200 \h 67 6.2 H?￾p tho タi PAGEREF _Toc6394201 \h 67 6.2.1 Th?￾ng i?￾p(Message box) PAGEREF _Toc6394202 \h 67 6.2.2 H?￾p nh タp(Input box) PAGEREF _Toc6394203 \h 68 6.2.3 C?￾c h?￾p tho タi th?￾ng d?￾ng(Common dialog) PAGEREF _Toc6394204 \h 68 6.2.4 H?￾p tho タi hi?￾u ch?￾nh PAGEREF _Toc6394205 \h 69 6.3 Thanh c?￾ng c?￾(ToolBar) PAGEREF _Toc6394206 \h 69 6.3.1 Trong ?￾ng d?￾ng タn gi タn PAGEREF _Toc6394207 \h 69 6.3.2 Nh?￾ng ?￾i t タ?￾ng PAGEREF _Toc6394208 \h 69 6.4 Thanh tr タng th?￾i PAGEREF _Toc6394209 \h 69 6.5 X?￾ l?￾ chu?￾t v?￾ b?￾n ph?￾m PAGEREF _Toc6394210 \h 70 6.5.1 s?￾ ki?￾ n chu?￾t PAGEREF _Toc6394211 \h 70 6.5.2 Hi?￾u ch?￾nh tr?￾ chu?￾t PAGEREF _Toc6394212 \h 70 6.5.3 S?￾ ki?￾n b?￾n ph?￾m PAGEREF _Toc6394213 \h 70 X?￾ l?￾ t タp tin PAGEREF _Toc6394214 \h 72 7.1 M?￾ h?￾nh FSO(File System Object model) PAGEREF _Toc6394215 \h 72 7.2 X?￾ l?￾ c?￾c t タp tin v?￾i c?￾c d?￾ng l?￾nh v?￾ h?￾m I/O c?￾ i?￾n PAGEREF _Toc6394216 \h 72 7.2.1 C?￾c ki?￾u truy c タp t タp tin PAGEREF _Toc6394217 \h 72 7.3 C?￾c i?￾u khi?￾n tr?￾n h?￾ th?￾ng t タp tin PAGEREF _Toc6394218 \h 75 7.3.1 H?￾p danh s?￾ch ?￾ )a PAGEREF _Toc6394219 \h 75 7.3.2 H?￾p danh s?￾ch th タ m?￾c PAGEREF _Toc6394220 \h 75 7.3.3 H?￾p danh s?￾ch t タp tin PAGEREF _Toc6394221 \h 76 7.4 i?￾u khi?￾n richtextbox PAGEREF _Toc6394222 \h 76 7.4.1 Ph タタng th?￾c loadfile PAGEREF _Toc6394223 \h 77 7.4.2 Ph タタng th?￾c savefile PAGEREF _Toc6394224 \h 77 S?￾ d?￾ng DLL v?￾ Windows API PAGEREF _Toc6394225 \h 78 8.1 DLL v?￾ c タu tr?￾c c?￾a Windows PAGEREF _Toc6394226 \h 78 8.1.1 C?￾c h?￾p tho タi th?￾ng d?￾ng PAGEREF _Toc6394227 \h 78 8.2 WIN API PAGEREF _Toc6394228 \h 79 8.3 S?￾ d?￾ng API PAGEREF _Toc6394229 \h 80 8.3.1 T?￾m kiタm API PAGEREF _Toc6394230 \h 80 8.3.2 C?￾c DLL c?￾a Windows PAGEREF _Toc6394231 \h 80 8.3.3 G?￾i API PAGEREF _Toc6394232 \h 81 8.4 D?￾ng API khai th?￾c kh タ nng Multimedia PAGEREF _Toc6394233 \h 84 8.4.1 L?￾p multimedia PAGEREF _Toc6394234 \h 84 Th?￾m tr?￾ gi?￾p v?￾o ?￾ng d?￾ng PAGEREF _Toc6394235 \h 96 9.1 Th?￾m h?￾ tr?￾ cho Help PAGEREF _Toc6394236 \h 96 9.1.1 Thu?￾c t?￾nh HelpFile PAGEREF _Toc6394237 \h 96 9.1.2 Thu?￾c t?￾nh HelpContextID PAGEREF _Toc6394238 \h 96 9.2 Th?￾m h?￾ tr?￾ cho WHAT S THIS HELP PAGEREF _Toc6394239 \h 97 9.2.1 K?￾ch ho タt What s This Help cho bi?￾u m タu PAGEREF _Toc6394240 \h 97 9.3 Cung c タp help c?￾ng v?￾i ?￾ng d?￾ng PAGEREF _Toc6394241 \h 98 9.3.1 Cung c タp WinHelp PAGEREF _Toc6394242 \h 98 9.3.2 Cung c タp HTML Help PAGEREF _Toc6394243 \h 98 10 L タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng PAGEREF _Toc6394244 \h 99 10.1 Gi?￾i thi?￾u v?￾ ?￾i t タ?￾ng PAGEREF _Toc6394245 \h 99 10.1.1 ?￾i t タ?￾ng VB PAGEREF _Toc6394246 \h 100 10.1.2 Modul L?￾p PAGEREF _Toc6394247 \h 100 10.1.3 Tham s?￾ tu?￾ ch?￾n PAGEREF _Toc6394248 \h 105 10.1.4 S?￾ ki?￾n c?￾a l?￾p PAGEREF _Toc6394249 \h 106 10.1.5 Hu?￾ ?￾i t タ?￾ng PAGEREF _Toc6394250 \h 107 10.2 Biタn ?￾i t タ?￾ng PAGEREF _Toc6394251 \h 108 10.2.1 T タo i?￾u khi?￾n l?￾c thi h?￾nh PAGEREF _Toc6394252 \h 108 10.2.2 S?￾ ki?￾n c?￾a m タng i?￾u khi?￾n PAGEREF _Toc6394253 \h 109 10.2.3 Qu タn l?￾ i?￾u khi?￾n nh タ biタn ?￾i t タ?￾ng PAGEREF _Toc6394254 \h 110 10.2.4 Khai b?￾o biタn ?￾i t タ?￾ng PAGEREF _Toc6394255 \h 112 10.3 T タp h?￾p PAGEREF _Toc6394256 \h 114 10.3.1 Thu?￾c t?￾nh Controls PAGEREF _Toc6394257 \h 114 10.3.2 X?￾c ?￾nh i?￾u khi?￾n tr?￾n bi?￾u m タu PAGEREF _Toc6394258 \h 114 10.4 Bi?￾u m タu MDI PAGEREF _Toc6394259 \h 117 10.4.1 Bi?￾u m タu (Child Form) PAGEREF _Toc6394260 \h 117 10.4.2 T タo Instance c?￾a bi?￾u m タu PAGEREF _Toc6394261 \h 117 10.4.3 X?￾c ?￾nh bi?￾u m タu PAGEREF _Toc6394262 \h 118 10.4.4 T タo danh s?￾ch c?￾a s?￾ PAGEREF _Toc6394263 \h 118 11 C?￾ng c?￾ VB6 PAGEREF _Toc6394264 \h 120 11.1 ADD-INS PAGEREF _Toc6394265 \h 120 11.2 C?￾c c?￾ng c?￾ ADD-INS PAGEREF _Toc6394266 \h 120 11.2.1 Tr?￾nh c?￾i タt ?￾ng d?￾ng PAGEREF _Toc6394267 \h 120 11.2.2 Tr?￾nh ?￾i t タ?￾ ng d?￾ li?￾u t?￾ ?￾ng PAGEREF _Toc6394268 \h 120 11.2.3 Tr?￾nh x?￾y d?￾ng d?￾ li?￾u t?￾ ?￾ng PAGEREF _Toc6394269 \h 121 11.2.4 Tr?￾nh thiタt kタ Add-ins t?￾ ?￾ng PAGEREF _Toc6394270 \h 122 11.2.5 Tr?￾ nh thiタt kタ t?￾ ?￾ng PAGEREF _Toc6394271 \h 122 11.2.6 Ti?￾n ?￾ch x?￾y d?￾ng l?￾p PAGEREF _Toc6394272 \h 123 11.2.7 Tr?￾nh t タo c?￾ng c?￾ t?￾ ?￾ng PAGEREF _Toc6394273 \h 123 11.3 Tr?￾nh ?￾ng g?￾i v?￾ tri?￾n khai ?￾ng d?￾ng PAGEREF _Toc6394274 \h 124 11.3.1 Ph?￾t h?￾nh ?￾ng d?￾ng PAGEREF _Toc6394275 \h 124 11.3.2 Tr?￾nh ?￾ng g?￾i v?￾ tri?￾n khai ?￾ng d?￾ng PAGEREF _Toc6394276 \h 124 11.3.3 M?￾ tr?￾nh ?￾ng g?￾i v?￾ tri?￾n khai VB PAGEREF _Toc6394277 \h 124 11.3.4 M?￾ tr?￾nh ?￾ng g?￾i v?￾ tri?￾ n khai nh タ m?￾t ?￾ng d?￾ng ?￾c l タp PAGEREF _Toc6394278 \h 124 11.3.5 Thi h?￾nh Wizard d タ?￾i chタ ?￾ silent PAGEREF _Toc6394279 \h 125 11.3.6 Setup toolkit PAGEREF _Toc6394280 \h 125 11.4 B?￾i t タp PAGEREF _Toc6394281 \h 126 12 Nh?￾ng kh?￾i ni?￾m c タ b タn v?￾ CSDL PAGEREF _Toc6394282 \h 127 12.1 C タ s?￾ d?￾ li?￾u l?￾ g?￾?￾ PAGEREF _Toc6394283 \h 127 12.1.1 B?￾ m?￾y (Engine) c タ s?￾ d?￾ li?￾u l?￾ g?￾?￾ PAGEREF _Toc6394284 \h 127 12.1.2 B タn v?￾ tr タ?￾ng PAGEREF _Toc6394285 \h 128 12.1.3 Recordset l?￾ g?￾ ?￾ PAGEREF _Toc6394286 \h 129 12.1.4 C?￾c ki?￾u c タ s?￾ d?￾ li?￾u PAGEREF _Toc6394287 \h 129 12.1.5 T タo l タ?￾c ?￾ c タ s?￾ d?￾ li?￾u PAGEREF _Toc6394288 \h 130 12.1.6 D?￾ng Visual Basic ?￾ t タo m?￾t c タ s?￾ d?￾ li?￾u PAGEREF _Toc6394289 \h 130 12.1.7 C?￾c m?￾i quan h?￾ PAGEREF _Toc6394290 \h 140 12.1.8 Chu タn ho?￾ PAGEREF _Toc6394291 \h 141 12.2 S?￾ d?￾ng c?￾ a s?￾ xem d?￾ li?￾u PAGEREF _Toc6394292 \h 143 12.3 T タo tr?￾nh thiタt kタ m?￾i tr タ?￾ng d?￾ li?￾u PAGEREF _Toc6394293 \h 145 12.3.1 T タo m?￾t giao di?￾n ng タ?￾i s?￾ d?￾ng v?￾i thiタt kタ DATAENVIRONMENT PAGEREF _Toc6394294 \h 146 12.4 S?￾ d?￾ng i?￾u khi?￾n d?￾ li?￾u ?￾ t タo giao di?￾ n ng タ?￾i s?￾ d?￾ng PAGEREF _Toc6394295 \h 147 12.4.1 Kタt n?￾i v?￾i m?￾t c タ s?￾ d?￾ li?￾u v?￾ l?￾m vi?￾c v?￾i c?￾c m タu tin PAGEREF _Toc6394296 \h 148 12.4.2 T タo m?￾t giao di?￾n ng タ?￾i s?￾ d?￾ng c タ b タn PAGEREF _Toc6394297 \h 150 12.4.3 Thao t?￾c tr?￾n c?￾c m タu tin th?￾ng qua i?￾u khi?￾n ADO Data PAGEREF _Toc6394298 \h 151 12.4.4 C?￾c thu?￾c t?￾nh quan tr?￾ng kh?￾c c?￾a i?￾u khi?￾n ADO DATA PAGEREF _Toc6394299 \h 155 12.5 T?￾ng kタt PAGEREF _Toc6394300 \h 156 12.6 H?￾i v?￾ ?￾p PAGEREF _Toc6394301 \h 157 13 C?￾c ?￾i t タ?￾ng truy c タp d?￾ li?￾u PAGEREF _Toc6394302 \h 158 13.1 S?￾ d?￾ng m?￾ h?￾nh ?￾i t タ?￾ng DAO PAGEREF _Toc6394303 \h 158 13.1.1 L タp tr?￾nh v?￾i ?￾i t タ?￾ng PAGEREF _Toc6394304 \h 160 13.1.2 S?￾ d?￾ng i?￾u khi?￾n DAO Data PAGEREF _Toc6394305 \h 160 13.1.3 S?￾ d?￾ng thu?￾c t?￾nh Connect c?￾a i?￾u khi?￾n DAO Data ?￾ truy c タp ngu?￾n d?￾ li?￾u b?￾n ngo?￾i PAGEREF _Toc6394306 \h 160 13.2 S?￾ d?￾ng DAO ?￾ l?￾m vi?￾c v?￾i d?￾ li?￾u PAGEREF _Toc6394307 \h 161 13.2.1 D?￾ng ?￾i t タ?￾ng DataBase ?￾ kタt n?￾i v?￾i m?￾t CSDL PAGEREF _Toc6394308 \h 161 13.2.2 S?￾ d?￾ng ?￾i t タ?￾ng Recordset PAGEREF _Toc6394309 \h 162 13.2.3 Ch?￾ c?￾c tu?￾ ch?￾n cho Recordset PAGEREF _Toc6394310 \h 163 13.3 S?￾ d?￾ng ?￾i t タ?￾ng Field ?￾ thao t?￾c v?￾i c?￾c tr タ?￾ng PAGEREF _Toc6394311 \h 163 13.4 S?￾d?￾ng c?￾c ph タタng th?￾c duy?￾t v?￾i ?￾i t タ?￾ng Recorset PAGEREF _Toc6394312 \h 164 13.4.1 S?￾ d?￾ng BOF v?￾ EOF ?￾ duy?￾t qua Recordset PAGEREF _Toc6394313 \h 164 13.4.2 D?￾ng BOF v?￾ EOF ?￾ x?￾c ?￾nh m?￾t Recordset c?￾ r?￾ng hay kh?￾ng PAGEREF _Toc6394314 \h 164 13.4.3 D?￾ng thu?￾c t?￾nh RecordCout ?￾ x?￾c ?￾nh s?￾ m タu tin m?￾t recordset PAGEREF _Toc6394315 \h 165 13.4.4 D?￾ng ph タタng th?￾c Edit ?￾ s?￾a ?￾i gi?￾ tr?￾ m?￾t m タu tin PAGEREF _Toc6394316 \h 165 13.4.5 S?￾ d?￾ng ph タタng th?￾c AddNew v?￾ Update ?￾ t タo m タu tin m?￾i PAGEREF _Toc6394317 \h 166 13.4.6 S?￾ d?￾ng AppendChunk ?￾ n?￾i d?￾ li?￾u v?￾o m?￾t tr タ?￾ng nh?￾ ph?￾n PAGEREF _Toc6394318 \h 167 13.4.7 S?￾ d?￾ng ph タタng th?￾c Close ?￾ ?￾ng Recordset PAGEREF _Toc6394319 \h 168 13.5 T?￾m kiタm d?￾ li?￾u Recordset v?￾ b タng PAGEREF _Toc6394320 \h 168 13.5.1 S?￾ d?￾ng ph タタng th?￾c Find ?￾ ?￾nh v?￾ m タu tin m?￾t recordset PAGEREF _Toc6394321 \h 168 13.5.2 S?￾ d?￾ ng ph タタng th?￾c Seek ?￾ thi h?￾nh t?￾m kiタm theo ch?￾ m?￾c PAGEREF _Toc6394322 \h 169 13.5.3 L タp qua su?￾t t タp h?￾p Indexes c?￾a TableDef PAGEREF _Toc6394323 \h 170 13.5.4 S?￾ d?￾ng thu?￾c t?￾nh Bookmark ?￾ ghi nh?￾ v?￾ tr?￾ m?￾t Recordset PAGEREF _Toc6394324 \h 171 13.5.5 s?￾ d?￾ng t タp h?￾p Errors v?￾ ?￾i t タ?￾ng Error ?￾ x?￾ l?￾ l?￾i PAGEREF _Toc6394325 \h 171 13.6 T タo ?￾i t タ?￾ng ?￾ thao t?￾c tr?￾n c タu tr?￾c c?￾a m?￾t CSDL PAGEREF _Toc6394326 \h 172 13.6.1 T タo m?￾t CSDL PAGEREF _Toc6394327 \h 172 13.6.2 S?￾ d?￾ng ?￾i t タ?￾ng TableDef ?￾ thao t?￾c v?￾i b タng PAGEREF _Toc6394328 \h 173 13.7 L?￾m vi?￾c v?￾i t?￾i li?￾u v?￾ n タi ch?￾a CSDL PAGEREF _Toc6394329 \h 178 13.8 T タo v?￾ s?￾ d?￾ng c?￾c thu?￾c t?￾nh hi?￾u ch?￾nh c?￾a ?￾i t タ?￾ng DataBase PAGEREF _Toc6394330 \h 179 13.9 T?￾ng kタt PAGEREF _Toc6394331 \h 180 13.10 H?￾i v?￾ ?￾p PAGEREF _Toc6394332 \h 181 14 Thiタt l タp b?￾o c?￾o v?￾ Xu タt th?￾ng tin PAGEREF _Toc6394333 \h 182 14.1 S?￾ d?￾ng thiタt kタ DataReport PAGEREF _Toc6394334 \h 182 14.1.1 Thiタt kタ v?￾i DataReport PAGEREF _Toc6394335 \h 183 14.1.2 Xem v?￾ xu タt DataReport PAGEREF _Toc6394336 \h 185 14.2 S?￾ d?￾ng Microsoft Access ?￾ l?￾m b?￾o c?￾o PAGEREF _Toc6394337 \h 185 14.2.1 Thi h?￾nh b?￾o c?￾o c?￾a Access t?￾ Visual Basic PAGEREF _Toc6394338 \h 185 14.3 S?￾ d?￾ng Crystal report ?￾ l タp b?￾o c?￾o PAGEREF _Toc6394339 \h 190 14.3.1 C?￾i タt Crystal Reports PAGEREF _Toc6394340 \h 190 14.3.2 D?￾ng Crystal Reports t タo b?￾o c?￾o PAGEREF _Toc6394341 \h 191 14.3.3 Thi h?￾nh b?￾o c?￾o ?￾ng d?￾ng v?￾i i?￾u khi?￾n ActiveX c?￾a Crystal Reports PAGEREF _Toc6394342 \h 193 14.3.4 S?￾ d?￾ng b タn m?￾i h タn c?￾a Crystal Reports PAGEREF _Toc6394343 \h 193 15 ODBC v?￾ c?￾c ?￾i t タ?￾ng d?￾ li?￾u t?￾ xa PAGEREF _Toc6394344 \h 194 15.1 ?￾nh c タu h?￾nh v?￾ s?￾ d?￾ng ODBC PAGEREF _Toc6394345 \h 194 15.1.1 Kiタn tr?￾c c?￾a ODBC PAGEREF _Toc6394346 \h 194 15.1.2 T タo ngu?￾n d?￾ li?￾u PAGEREF _Toc6394347 \h 194 15.1.3 Truy c タp ngu?￾n d?￾ li?￾u v?￾i i?￾u khi?￾n DAO DATA v?￾ ODBCDIRECT PAGEREF _Toc6394348 \h 197 15.2 Truy c タp d?￾ li?￾u d?￾ng i?￾u khi?￾n d?￾ li?￾u t?￾ xa PAGEREF _Toc6394349 \h 198 15.2.1 S?￾ d?￾ng RDC PAGEREF _Toc6394350 \h 198 15.3 S?￾ d?￾ng RDO ch タタng tr?￾nh PAGEREF _Toc6394351 \h 199 15.3.1 Quy ?￾nh thu?￾c t?￾nh b?￾ m?￾y c タ s?￾ d?￾ li?￾u d?￾ng ?￾i t タ?￾ng RDOENGINE PAGEREF _Toc6394352 \h 200 15.3.2 Truy c タp m?￾i tr タ?￾ng ?￾i t タ?￾ng rdoEnvironment PAGEREF _Toc6394353 \h 200 15.3.3 Thiタt l タp kタt n?￾i d?￾ng ?￾i t タ?￾ng rdoConnection PAGEREF _Toc6394354 \h 201 15.3.4 ?￾p ?￾ng s?￾ ki?￾n RDO PAGEREF _Toc6394355 \h 203 15.4 T タo kタt n?￾I v?￾i tr?￾nh thiタt kタ uerconnecttion PAGEREF _Toc6394356 \h 204 15.5 Truy c タp truy v タn v?￾i tr?￾ ng thiタt kタ UserConnection PAGEREF _Toc6394357 \h 206 15.5.1 G?￾i th?￾ t?￾c ch?￾a s タn m?￾t tr?￾ nh thiタt kタ UserConnection PAGEREF _Toc6394358 \h 206 15.5.2 D?￾ng Microsotf Query ?￾ x?￾y d?￾ng chu?￾i SQL tr?￾nh thiタt kタ UserConnection PAGEREF _Toc6394359 \h 208 15.6 S?￾ d?￾ng d?￾ li?￾u v?￾i ?￾i t タ?￾ng rdorerultset PAGEREF _Toc6394360 \h 209 15.7 Thi h?￾nh truy v タn v?￾i ?￾i t タ?￾ng rdoQuery PAGEREF _Toc6394361 \h 209 16 Truy c タp c タ s?￾ d?￾ li?￾u v?￾i l?￾p PAGEREF _Toc6394362 \h 211 16.1 L?￾m vi?￾c v?￾i l?￾p v?￾ ?￾i t タ?￾ng PAGEREF _Toc6394363 \h 212 16.1.1 T タo c?￾y ph?￾n nh?￾nh l?￾p v?￾i ti?￾n ?￾ch x?￾y d?￾ng l?￾p PAGEREF _Toc6394364 \h 212 16.1.2 S?￾ d?￾ng bi?￾u m タu nh タ l?￾p PAGEREF _Toc6394365 \h 216 16.2 T タo Intance b?￾i cho bi?￾u m タu PAGEREF _Toc6394366 \h 218 16.2.1 S?￾ d?￾ng l?￾p v?￾ ?￾i t タ?￾ng truy c タp c タ s?￾ d?￾ li?￾u PAGEREF _Toc6394367 \h 218 16.3 T タo c?￾c l?￾p c タn s?￾ d?￾ng d?￾ li?￾u PAGEREF _Toc6394368 \h 221 16.3.1 T タo l?￾p xu タt d?￾ li?￾u PAGEREF _Toc6394369 \h 223 16.3.2 Tri?￾n khai l?￾p th?￾nh Active Server PAGEREF _Toc6394370 \h 224 16.4 T?￾ ng kタt PAGEREF _Toc6394371 \h 229 17 Truy c タp d?￾ li?￾u t?￾ xa PAGEREF _Toc6394372 \h 230 17.1 Client / Server v?￾ c?￾c th?￾nh ph タn PAGEREF _Toc6394373 \h 230 17.1.1 C タu tr?￾c Cilent/Server Three- Tier PAGEREF _Toc6394374 \h 230 17.2 PAGEREF _Toc6394375 \h 251 18 ?￾i t タ?￾ng d?￾ li?￾u ActiveX PAGEREF _Toc6394376 \h 252 18.1 X?￾y d?￾ng ?￾ng d?￾ng Visual basic v?￾i ADO PAGEREF _Toc6394377 \h 252 18.1.1 T?￾m hi?￾u c タu tr?￾c OLE DB / ADO PAGEREF _Toc6394378 \h 252 18.1.2 C?￾i タt v?￾ thiタt l タp tham chiタu タn ADO ?￾ng d?￾ng Visual basic PAGEREF _Toc6394379 \h 253 18.1.3 S?￾ d?￾ng ADO v?￾i c?￾c th タ vi?￾n ?￾i t タ?￾ng truy c タp d?￾ li?￾u kh?￾c PAGEREF _Toc6394380 \h 254 18.1.4 D?￾ng ?￾i t タ?￾ng connection c?￾a ADO ?￾ kタt n?￾i v?￾i ngu?￾n d?￾ li?￾u PAGEREF _Toc6394381 \h 254 18.1.5 L?￾m vi?￾c v?￾i tr?￾ PAGEREF _Toc6394382 \h 255 18.1.6 Kho?￾ b タn ghi ADO PAGEREF _Toc6394383 \h 257 18.1.7 S?￾ d?￾ng ?￾i t タ?￾ng Recordset c?￾a ADO ?￾ thao t?￾c v?￾i d?￾ li?￾u PAGEREF _Toc6394384 \h 257 18.1.8 T タo Recordset ng タt kタt n?￾i PAGEREF _Toc6394385 \h 258 18.2 S?￾ d?￾ng d?￾ch v?￾ d?￾ li?￾u t?￾ xa c?￾a ADO PAGEREF _Toc6394386 \h 259 L?￾m quen v?￾i visual basic 6.0 X?￾y d?￾ng ?￾ng d?￾ng ban タu Viタt ?￾ng d?￾ng ban タu C?￾ch t?￾t nh タt ?￾ h?￾c l タp tr?￾nh l?￾ viタt ch タタng tr?￾nh V タy h?￾y th?￾ viタt ch タタng tr?￾nh hi?￾n th?￾ l?￾ch bi?￾u, ?￾ cho ph?￾p ng タ?￾i s?￾ d?￾ng: Hi?￾n th?￾ l?￾ ch bi?￾u c?￾a th?￾ng hi?￾n h?￾nh Duy?￾t qua c?￾c th?￾ng Hi?￾n th?￾ ?￾ng h?￾ b?￾o gi?￾ hi?￾n h?￾nh Nタu b タn cho r タng ch タタng tr?￾nh n?￾y c?￾ v タ n タng n?￾ cho ng タ?￾i m?￾i h?￾c, ?￾ng lo l タng Visual basic l?￾m hタt m?￾i vi?￾c cho b タn Kh?￾c v?￾i ng?￾n ng?￾ C++, b タn ph タi viタt m?￾i th?￾ m?￾t ?￾t, Visual basic cung c タp m?￾c ?￾ cao h タn c?￾ a l タp tr?￾nh t?￾ ?￾ng Nh タ v タy, b タn c?￾ th?￾ l?￾m nhi?￾u th?￾ m?￾ kh?￾ng ph タi l タp tr?￾nh nhi?￾u Tuy nhi?￾n, ?￾ ng hi?￾u sai kh?￾ng l タp tr?￾nh nhi?￾u ngh)a l?￾ kh?￾ng c?￾ nhi?￾u t?￾nh nng m タnh Visual basic l?￾ m?￾t ng?￾n ng?￾ r タt m タnh Ta c?￾ th?￾ l タp tr?￾nh ?￾ l?￾m m?￾i th?￾ nタu c タn Ta cing c?￾ th?￾ khai th?￾c kh タ nng t?￾ ?￾ng c?￾ a Visual basic ?￾ viタt ch タタng tr?￾nh th タt nhanh Ch?￾n l?￾a l?￾ ?￾ ng タ?￾i l タp tr?￾nh Visual basic ?￾ linh ho タt ?￾ h?￾ tr?￾ cho ng タ?￾i l タp tr?￾nh t?￾ ng タ?￾i m?￾i h?￾c タn l タp tr?￾nh chuy?￾n nghi?￾p X?￾y d?￾ng t?￾nh nng Calendar B?￾y gi?￾ ta b タt タu x?￾y d?￾ng c?￾c t?￾nh nng c?￾a ?￾ng d?￾ng タu ti?￾n, ta c タn m?￾t l?￾ch bi?￾u Ta c?￾ th?￾ t?￾ t タo n?￾ ho タc s?￾ d?￾ng l?￾ch bi?￾u c?￾ s タn c?￾a Visual basic (?￾y l?￾ m?￾t i?￾u khi?￾n ActiveX) Ta ch?￾n c?￾ ch th?￾ T?￾ menu Project, ch?￾n Components B?￾i v?￾, m タc ?￾nh t タt c タ c?￾c i?￾u khi?￾n ActiveX c?￾a Visual basic kh?￾ng タ?￾c n タp t?￾ ?￾ng Mu?￾n d?￾ng b タn ph タi ch?￾n t?￾ menu Components Trong h?￾p tho タi Components ch?￾n Windows Common Controls 2.6.0 v?￾ nh タn OK EMBED PBrush ActivateX l?￾ g?￾?￾ ActivateX l?￾ s タn ph タm c?￾a Microsoft cho ph?￾p ta t タo nh?￾ng ch タタng tr?￾nh nh?￾, g?￾i l?￾ c?￾c th?￾nh ph タn(componet) v?￾ c?￾c i?￾u khi?￾n (control) ?￾ c?￾ th?￾ th?￾m v?￾o c?￾c ch タタng tr?￾nh l?￾n ?￾ c?￾ th?￾ l?￾ c?￾c ch タ タng tr?￾nh ?￾c l タp (Standalone program) hay c?￾c ch タタng tr?￾nh ch タy tr?￾n Internet Ta c?￾ th?￾ d?￾ng Visual basic ?￾ t?￾ t タo c?￾c i?￾u khi?￾n ActivateX Ph タn n?￾y s タ タ?￾c tr?￾nh b?￾y m?￾t ri?￾ng タn ?￾y i?￾u khi?￾n l?￾ch タ?￾c n タp v?￾o c?￾ng c?￾ T?￾n ch?￾nh th?￾c c?￾a n?￾ l?￾ i?￾u khi?￾n ActivateX MonthView Kタ tiタp ta タa i?￾u khi?￾n v?￾o bi?￾u m タu Th?￾m i?￾u khi?￾n MonthView v?￾o bi?￾u m タu Ch?￾n bi?￾u t タ?￾ng i?￾u khi?￾n MonthView t?￾ h?￾p c?￾ng c?￾ Nh タn ?￾p chu?￾t l?￾n bi?￾u t タ?￾ng i?￾u khi?￾n ?￾ タa n?￾ v?￾o bi?￾u m タu B タn v?￾a t タo xong ch タタng tr?￾nh nh タn F5 ?￾ ch タy Th?￾m t?￾nh nng Clock T?￾nh nng kタ tiタp l?￾ hi?￾n th?￾ gi?￾ Ta s タ d?￾ng i?￾u khi?￾n ActivateX Timer l?￾ m?￾t i?￾u khi?￾n n?￾i t タi c?￾a Visual basic i?￾u khi?￾n n?￾i t?￾a lu?￾n タ?￾c n タp s タn h?￾p c?￾ng c?￾ Th?￾m Timer v?￾o ?￾ng d?￾ng Ch?￾n v?￾o bi?￾u t タ?￾ng h?￾p c?￾ng c?￾ Nh タn chu?￾t l?￾n i?￾u khi?￾n Timer tr?￾n h?￾p c?￾ng c?￾ ?￾ タa n?￾ v?￾o bi?￾u m タu ?￾ hi?￾n th?￾ th?￾i gian ta l タp tr?￾nh i?￾ u khi?￾n Timer Ta d?￾ng thu?￾c t?￾nh Interval c?￾a timer ?￾ quy ?￾nh vi?￾c タm th?￾i gian M?￾t タn v?￾ c?￾a Interval l?￾ 1/1000 gi?￾y Do ?￾, ?￾ quy inh nh?￾p タm l?￾ n?￾a gi?￾y ta タt Interval l?￾ 500 C?￾ m?￾i n?￾a gi?￾y ch タタng tr?￾nh s タ l?￾m m?￾t vi?￾c g?￾ ?￾ ?￾ ?￾y, ta mu?￾n hi?￾n th?￾ th?￾i gian hi?￾n h?￾nh Ta s タ d?￾ng nh?￾n (label) ?￾ hi?￾n th?￾ th?￾i gian Hi?￾n th?￾ Timer Th?￾m Label v?￾o bi?￾u m タu Ch?￾n i?￾u khi?￾n nh?￾n t?￾ h?￾p c?￾ng c?￾ v?￾ k?￾o n?￾ v?￾o bi?￾u m タu Th?￾ t?￾c s?￾ ki?￾n l?￾ g?￾?￾ M?￾t th?￾ t?￾c s?￾ ki?￾n l?￾ m?￾t o タn ch タタng tr?￾nh s タ thi h?￾nh s?￾ ki?￾n ?￾ x タy V?￾ d?￾, ng タ?￾i s?￾ d?￾ng nh タn v?￾o n?￾t CommandButton, s?￾ ki?￾n click() s タ タ?￾c sinh Visual basic cung c タp th?￾ t?￾c CommandButton_Click cho ta l タp tr?￾nh ?￾ ?￾ng d?￾ng ph タn ?￾ng ?￾i v?￾i vi?￾c nh タn n?￾t CommandBuuton T タタng t?￾ v?￾i Timer Khi ?￾ng nh?￾p タm Timer s?￾ ki?￾n Timer() s タ ph?￾t ?￾ hi?￾n th?￾ th?￾i gian tr?￾n nh?￾n label ta タa d?￾ng l?￾nh sau v?￾o th?￾ t?￾c s?￾ ki?￾n c?￾a timer: Label1.Caption = time Private Sub Timer1_Timer() Label1.Caption = Time End Sub C?￾c t?￾nh nng m?￾i Visual basic 6.0 Kh?￾i qu?￾t v タn t タt v?￾ Visual basic 6.0 Nタu b タn ch タa quen v?￾i Visual basic, t?￾a ?￾ c?￾a ph タn n?￾y c?￾ th?￾ l?￾m nh タm l タn ?￾i ch?￾t R?￾ r?￾ng r タng nタu b タn l?￾ ng タ?￾i m?￾i h?￾c ng?￾n ng?￾, m?￾i th?￾ v?￾ Visual basic ?￾u m?￾i c タ D?￾ v タy, b タn kh?￾ng n?￾n b?￾ qua ph タn n?￾y, nh タt l?￾ c?￾c i?￾u khi?￾n ActivateX m?￾i ?￾i v?￾i c?￾c b タn ?￾ quen thu?￾c c?￾c phi?￾n b タn Visual basic tr タ?￾c th?￾ ph タn n?￾y th タt h?￾u ?￾ch Visual basic 6.0 c?￾ r タt nhi?￾u t?￾nh nng m?￾i C?￾c i?￾u khi?￾n m?￾i cho ph?￾p ta viタt ch タタng tr?￾nh ?￾ng d?￾ng kタt h?￾p giao di?￾n, c?￾ch x?￾ l?￾ v?￾ t?￾nh nng c?￾a Office 97 v?￾ tr?￾nh duy?￾t WEB internet explorer Kh?￾ng nh タt thiタt ph タi c?￾ m?￾t instance c?￾a i?￾u khi?￾n tr?￾n bi?￾u m タu, Visual basic cho ph?￾p ta l タp tr?￾nh ?￾ th?￾m i?￾u khi?￾n v?￾o ?￾ ?￾ n t?￾ ?￾ng v?￾ ta c?￾ th?￾ t タo c?￾c i?￾u khi?￾n ActivateX hi?￾u ch?￾nh M?￾t v?￾i c タi tiタn cho ph?￾p l?￾m vi?￾c v?￾i c?￾c ?￾ng d?￾ng truy c タp d?￾ li?￾u ?￾ t タm c?￾ v) m?￾ li?￾n quan タn h?￾ng trm h?￾ng ngh?￾n ng タ?￾i s?￾ d?￾ng qua m タng Internet Khai th?￾c thタ m タnh c?￾a c?￾c i?￾u khi?￾n m?￾ r?￾ng s?￾ ki?￾n Validate v?￾ thu?￾c t?￾nh CausesValidation Ph タn m?￾ r?￾ng タu ti?￾n li?￾n quan タn t タt c タ c?￾c i?￾u khi?￾n ActivateX c タ b タn l?￾ vi?￾c th?￾m v?￾o s?￾ ki?￾n Validate v?￾ thu?￾c t?￾nh CausesValidation Tr タ?￾c c?￾c phi?￾n b タn Visual basic 6, nタu b タn ki?￾m tra t?￾nh h?￾p l?￾ c?￾a m?￾t t?￾ nh タp v?￾o h?￾p b タn, b タn ph タi viタt th?￾ t?￾c s?￾ ki?￾n LostForcus c?￾ a TextBox Nタu nh タp sai b タn ph タi g?￾i ph タタng th?￾c SetForcus ?￾ bu?￾c ng タ?￾i d?￾ng nh タp l タi d?￾ li?￾u ?￾ng Th?￾nh tho タng logic c?￾a l タp tr?￾nh n?￾y l?￾m ng タ?￾i d?￾ng kh?￾ ch?￾u h?￾ kh?￾ng bao gi?￾ nh タp ?￾ng d?￾ li?￾u, h?￾ c?￾ th?￾ b?￾ kho?￾ ch タt ?￾ i?￾u khi?￾n ?￾ h?￾ cing cing kh?￾ng nh タn c タ n?￾t help ?￾ xem h タ?￾ng d タn chi tiタt S?￾ ki?￾n Validate v?￾ thu?￾c t?￾nh CausesValidation gi タi quyタt v タn ?￾ ?￾ C?￾c c タi tiタn ?￾ ho タ m?￾i l?￾m ?￾ng d?￾ng th?￾m sinh ?￾ng Visual basic lu?￾n cho ph?￾p b タn s?￾ d?￾ng ?￾ ho タ ?￾ l?￾m ch タタng tr?￾nh s?￾ng ?￾ ng v?￾ Microsoft c?￾ kh タ nng ?￾ ho タ m?￾ r?￾ng cho nhi?￾u i?￾u khi?￾n タu ti?￾n, i?￾u khi?￾n ImageList gi?￾ ?￾y h?￾ tr?￾ c?￾c t タp tin.gif Ph タn m?￾ r?￾ng n?￾y r タt quan tr?￾ng b?￾i v?￾ n?￾ li?￾n quan タn c?￾c i?￾u khi?￾n c?￾ s?￾ d?￾ng i?￾u khi?￾n ImageList C?￾c i?￾u khi?￾n ListView v?￾ TabStrip c?￾ ph タn m?￾ r?￾ng cho ph?￾p s?￾ d?￾ng h?￾nh タnh v?￾ bi?￾u t タ?￾ng ?￾ trang tr?￾ v?￾ minh ho タ i?￾u khi?￾n listView cho ph?￾p t タo m?￾t タnh n?￾n cho v?￾ng l?￾m vi?￾c タnh n?￾n c?￾ th?￾ タ?￾c タt gi?￾a tr タi ?￾u ho タc タt ?￾ m?￾t g?￾c b タt k?￾ Ng?￾y th?￾ng v?￾i i?￾u khi?￾n MonthView v?￾ DataTimepicker VB6 c?￾ i?￾u khi?￾n タa gi タi ph?￾p m?￾i ?￾ xem x?￾t v?￾ ch?￾n l?￾a ng?￾y th?￾ng, MonthView v?￾ DataTimePicker i?￾u l?￾ th?￾ c?￾a c?￾c i?￾u khi?￾n l?￾ ch?￾ng cho ph?￾p ta xem v?￾ ch?￾n ng?￾y ng?￾ c タnh l?￾ch bi?￾u i?￾u khi?￾n MonthView tr?￾nh b?￾y m?￾t l?￾ch bi?￾u タy ?￾ ?￾ ta c?￾ th?￾ duy?￾t theo t?￾ng ng?￾y ho タc t?￾ng th?￾ng i?￾u khi?￾n DateTimePicker t タタng t?￾ nh タ MonthView, nh タng c?￾ i?￾m kh?￾c l?￾ l?￾ch bi?￾u s タ th タ xu?￾ng ng タ?￾i d?￾ng nh タn v?￾o mii t?￾n xu?￾ng c?￾a i?￾u khi?￾n L?￾m vi?￾c v?￾i m?￾i tr タ?￾ng l タp tr?￾nh Visual basic T?￾m hi?￾u c?￾c ph タn c?￾a IDE IDE l?￾ t?￾n viタt t タt c?￾a m?￾i tr タ?￾ng ph?￾t tri?￾n t?￾ch h?￾p (Inegreated Development Enviroment) IDE l?￾ n タi t タo c?￾c ch タタng tr?￾nh VB IDE c?￾a VB l?￾ n タi t タp trung c?￾c menu, c?￾ng c?￾ v?￾ c?￾a s?￾ ?￾ t タo ch タタng tr?￾nh M?￾i ph タn c?￾a IDE c?￾ c?￾c t?￾nh nng anhe h タ?￾ng タn c?￾c ho タt ?￾ng l タp tr?￾nh kh?￾c Thanh menu cho ph?￾p b タn t?￾c ?￾ng cing nh タ qu タn l?￾ tr?￾c tiタp tr?￾n to?￾n b?￾ ?￾ng d?￾ng Thanh c?￾ng c?￾ cho ph?￾p truy c タp c?￾c ch?￾c nng c?￾a menu qua c?￾c n?￾t tr?￾n c?￾ng c?￾ C?￾c bi?￾u m タu (Form) - kh?￾i x?￾y d?￾ng c?￾c ch タタng tr?￾nh Visual basic xu タt hi?￾n c?￾a s?￾ form H?￾p c?￾ng c?￾ ?￾ th?￾m c?￾c i?￾u khi?￾n v?￾o c?￾c bi?￾u m タu c?￾a ?￾ ?￾n Project explorer hi?￾n th?￾ c?￾c ?￾ ?￾n m?￾ b タn ang l?￾m cing nh タ c?￾c th?￾nh ph タn c?￾a c?￾c ?￾ ?￾n B タn duy?￾t v?￾ c?￾i タt c?￾c thu?￾c t?￾nh c?￾a i?￾u khi?￾n, bi?￾u m タu v?￾ module c?￾a s?￾ property Cu?￾i c?￾ng, b タn b?￾ tr?￾ v?￾ xem x?￾t m?￾t ho タc nhi?￾u bi?￾u m タu tr?￾n m?￾n h?￾nh th?￾ng qua c?￾a s?￾ form layout Th?￾m v?￾ xo?￾ c?￾c c?￾ng c?￾ IDE c?￾a Visual basic Thanh c?￾ng c?￾ l?￾ t タp h?￾p c?￾c n?￾t b タm mang bi?￾u t タ?￾ng ch?￾a m?￾t th タ?￾ng タt d タ?￾i menu C?￾c n?￾t n?￾y タm nh タn c?￾c ch?￾c nng th?￾ng d?￾ng c タu tr?￾c menu c?￾a Visual basic Thanh c?￾ng c?￾ r タt h?￾u ?￾ch, thay v?￾ ph タi l タn l タ?￾t ch?￾n qua menu v?￾ menu con, ta nh タn m?￾t n?￾t b タm n?￾o ?￾ c?￾ng c?￾ ?￾ g?￾i m?￾t ch?￾c nng t タタng t?￾ tr?￾n menu S?￾ d?￾ng c?￾ng c?￾ debug: Thanh c?￾ng c?￾ debug d?￾ng ?￾ ki?￾m tra ch タタng tr?￾nh v?￾ gi タi quyタt c?￾c l?￾i c?￾ th?￾ x タy Khi g?￾ r?￾i ch タタng tr?￾nh, ta l?￾m m?￾t s?￾ vi?￾c nh タ ch タy t?￾ng d?￾ng l?￾nh ch タタng tr?￾nh, ki?￾m tra gi?￾ tr?￾ c?￾c biタn, v?￾ d?￾ng ch タタng tr?￾nh t タi m?￾t i?￾m nghi ng?￾ ho タc d タ?￾i nh?￾ng i?￾u ki?￾n n?￾o ?￾ S?￾ d?￾ng c?￾ng c?￾ Edit: Thanh c?￾ng c?￾ Edit タ?￾c d?￾ng ?￾ viタt ch タタng tr?￾nh c?￾a s?￾ code C?￾c t?￾nh nng c?￾a c?￾ng c?￾ Edit t タタng t?￾ nh タ c?￾c t?￾nh nng kh?￾c ?￾ menu edit B タn c?￾ th?￾ Cut, Paste b タn M?￾t t?￾nh nng l?￾ th?￾ c?￾a IDE l?￾ c?￾ng c?￾ Edit d?￾ng t?￾nh nng Coplete Word, t?￾ ?￾ng ho?￾n t タt t?￾ kho?￾ T?￾nh nng Complete Word r タt h?￾u ?￾ch ?￾ tr?￾nh c?￾c l?￾i c?￾ ph?￾p S?￾ d?￾ng c?￾ng c?￾ Form Editor: Thanh c?￾ng c?￾ form editor d?￾ng ?￾ k?￾o gi?￾n, di chuy?￾n v?￾ s タp xタp c?￾c i?￾u khi?￾n tr?￾n bi?￾u m タu Thanh c?￾ng c?￾ Form editor c?￾ c?￾c t?￾nh nng nh タ menu Format S?￾ d?￾ng c?￾ng c?￾ chu タn(Standard): L?￾ c?￾ng c?￾ tr?￾ng yタu IDE Thanh c?￾ng c?￾ chu タn cung c タp nhi?￾u t?￾nh nng menu file, Project, Debug, v?￾ Run Th?￾m c?￾c i?￾u khi?￾n v?￾o h?￾p c?￾ng c?￾ H?￾p c?￾ng c?￾ l?￾ b タng ch?￾a c?￾c i?￾u khi?￾n v?￾ ta thiタt kタ giao di?￾n ng タ?￾i s?￾ d?￾ng b タng c?￾ch ch?￾n c?￾c i?￾u khi?￾n t?￾ h?￾p c?￾ng c?￾ v?￾ タa ch?￾ng v?￾o c?￾c bi?￾u m タu M?￾t s?￾ i?￾u khi?￾n c?￾ s タn Visual basic v?￾ kh?￾ng th?￾ g?￾ b?￾ kh?￾i h?￾p c?￾ng c?￾ M?￾t s?￾ kh?￾c n タm b?￾n ngo?￾i Visual basicv?￾ ch?￾a c?￾c t タp tin m?￾ c?￾ ph タn m?￾ r?￾ng l?￾ ocx C?￾c i?￾u khi?￾n n?￾y c?￾ th?￾ タ?￾ c th?￾m v?￾o ho タc g?￾ b?￾ kh?￾i c?￾ng c?￾ Ch?￾ng ta s タ tr?￾ l タi chi tiタt v?￾ c?￾c lo タi i?￾u khi?￾n Visual basic m?￾t ch タタng ri?￾ng ?￾nh h タ?￾ng th?￾ng qua c?￾a s?￾ form v?￾ code Nタu i?￾u khi?￾n l?￾ nh?￾ng kh?￾i b?￾ t?￾ng m?￾ ta t タp h?￾p ?￾ng d?￾ng th?￾ bi?￾u m タu l?￾ n?￾n m?￾ng ?￾ ta x?￾y d?￾ng c?￾c kh?￾i n?￾y C?￾c bi?￾u m タu ch?￾a c?￾a s?￾ Thiタt kタ bi?￾u m タu Ta s タ l?￾m vi?￾c c?￾a s?￾ n?￾y ?￾ th?￾m c?￾c i?￾u khi?￾n v?￾o bi?￾u m タu ?￾i v?￾i t?￾ng c?￾a s?￾ thiタt kタ m タu, ta cing c?￾ th?￾ m?￾ c?￾a s?￾ code C?￾a s?￾ code l?￾ n タi ta viタt c?￾c o タn ch タタng tr?￾nh ch タy b?￾n d タ?￾i bi?￾u m タu Ta c?￾ th?￾ m?￾ c?￾a s?￾ code b タng c?￾ch nh タn ?￾p l?￾n bi?￾u m タu ho タc i?￾u khi?￾n, ho タc ch?￾n code t?￾ menu Qu タn l?￾ ?￾ng d?￾ng v?￾i project explorer Project explorer Visual basic gi?￾p qu タn l?￾ v?￾ ?￾nh h タ?￾ng nhi?￾u ?￾ ?￾n Visual basic cho ph?￾p t?￾ ch?￾c nhi?￾u ?￾ ?￾n m?￾t nh?￾m g?￾i l?￾ project group Ta c?￾ th?￾ l タu t タp h?￾p c?￾c ?￾ ?￾n Visual basic th?￾nh m?￾t t タp tin nh?￾m ?￾ ?￾n C?￾c t タp tin n?￾y c?￾ ph タn m?￾ r?￾ng l?￾.vbg C?￾a s?￾ properties M?￾i thu?￾c t?￾nh c?￾ m?￾t ho タc nhi?￾u gi?￾ tr?￾ C?￾a s?￾ properties gi?￾p b タn xem s?￾a ?￾i v?￾ i?￾u khi?￾n c?￾c thu?￾c t?￾nh c?￾a c?￾c i?￾u khi?￾n ActivateX ch タタng tr?￾nh Hi?￾n th?￾ IDE Ta c?￾ th?￾ xem IDE c?￾a Visual basic b タng c?￾ch: MDI ho タc SDI Hi?￾n th?￾ ki?￾u MDI(Multiple document interface) cho ph?￾p tr?￾nh b?￾y t タt c タ c?￾c c?￾a s?￾ th?￾nh ph タn IDE nh タ l?￾ c?￾c c?￾a s?￾ ch?￾a m?￾t c?￾a s?￾ l?￾n Tr?￾i l タi ?￾i v?￾i hi?￾n th?￾ SDI(single document interface), c?￾c c?￾a s?￾ th?￾nh ph タn hi?￾n th?￾ m?￾t c?￾ch ?￾c l タp v?￾i Kh?￾ng c?￾ m?￾t c?￾a s?￾ ch?￾ nh ?￾ ch?￾a v?￾ th?￾ng nh タt c?￾c th?￾nh ph タn Chuy?￾n ?￾i t?￾ hi?￾n th?￾ MDI sang SDI Ch?￾n Tools\option\ Tr?￾n tang Advance, ch?￾n h?￾p ?￾nh d タu SDI development Enviroment; nh タn OK IDE c?￾a Visual basic s タ ?￾ nh l タi c タu h?￾nh cho hi?￾n th?￾ SDI l タn kh?￾i ?￾ng tiタp sau c?￾a Visual basic Nh タn OK, tho?￾t v?￾ kh?￾i ?￾ng l タi Visual basic Tr?￾ gi?￾p Kh?￾ng nh?￾ng l?￾m ch?￾ ng?￾n ng?￾ l タp tr?￾nh Visual basic, b タn cing c タn ph タi s?￾ d?￾ng thu タn th?￾c m?￾i tr タ?￾ng Visual basic cing nh タ hi?￾u c?￾c th?￾ng i?￾p m?￾ Visual basic g?￾i Microsoft cung c タp m?￾t nh?￾ng h?￾ th?￾ng tr?￾ gi?￾p t?￾t nh タt cho c?￾c c?￾ng c?￾ ph?￾t tri?￾n ?￾ng d?￾ng Tr?￾ gi?￾p nh タy v?￾i ng?￾ c タnh T タi m?￾t v?￾ tr?￾ b タt k?￾ Visual basic, b タn nh タn ph?￾m F1, n?￾t tr?￾ gi?￾ p N?￾ s タ k?￾ch ho タt h?￾ th?￾ng tr?￾ gi?￾p c?￾a Visual basic, n タi c?￾ th?￾ gi タi th?￾ch ho タc タa nh?￾ng l?￾i khuy?￾n, cing nh タ c?￾c o タn ch タタng tr?￾nh m タu Visual basic c?￾ h?￾ th?￾ng tr?￾ gi?￾p l?￾ h?￾ th?￾ng th タ vi?￾n MSDN タ?￾c s?￾ d?￾ng r?￾ng r?￾i cho c?￾c c?￾ng c?￾ ph?￾t tri?￾n c?￾a Microsoft ?￾ cung c タp truy c タp タn s?￾ tay h タ?￾ng d タn s?￾ d?￾ng s タn ph タm tr?￾c tuyタn T?￾m hi?￾u Visual basic Thu?￾c t?￾nh ph タタng th?￾c v?￾ s?￾ ki?￾n H?￾nh 9.3 Thiタt kタ bi?￾u m タu Nタu kh?￾ng th タy i?￾u khi?￾n h?￾p tho タi th?￾ng d?￾ng tr?￾n h?￾p c?￾ng c?￾, t?￾ menu Project, ch?￾n Components, v?￾ ch?￾n v?￾o h?￾p ?￾nh d タu Microsoft Common Dialog Control 6.0 ?￾ h?￾p tho タi (th?￾ng d?￾ng) b タt nh タn v?￾o n?￾t l?￾nh, ta x?￾ l?￾ s?￾ ki?￾n Click tr?￾n n?￾t l?￾nh b タng c?￾ch g?￾ v?￾o: Private Sub Command1_Click() With CommonDialog1 Filter = "WaveAudio (*.wav)|*.wav|Midi (*.mid)|*.mid| Video files (*.avi)|*.avi" FilterIndex = 0 ShowOpen End With End Sub Ch タy ch タタng tr?￾nh v?￾ nh タn n?￾t l?￾nh, ta s タ th タy h?￾p tho タi m?￾ t タp tin quen thu?￾c xu タt hi?￾n cho ta ch?￾n t タp tin multimedia: H?￾ nh 9.4 Ch?￾n m?￾ t タp tin multimedia Kタ tiタp ta chuy?￾n l?￾p multimedia th?￾nh m?￾t ?￾i t タ?￾ng Private Sub Command1_Click() Dim Multimedia As New MMedia With CommonDialog1 Filter = "WaveAudio (*.wav)|*.wav|Midi (*.mid)|*.mid|Video files (*.avi)|*.avi" FilterIndex = 0 ShowOpen End With If CommonDialog1.Filename "" Then Multimedia.mmOpen CommonDialog1.Filename Multimedia.mmPlay End If End Sub Thi h?￾nh ch タタng tr?￾nh T?￾m m?￾t t タp tin multimedia tr?￾n )a c?￾ng (th タ?￾ng ch?￾a th タ m?￾c \Windows\Media) v?￾ play L タu ?￾ r タng ?￾ play c?￾c t タp tin ?￾m nh タ WAV v?￾ MID, ta c タn c?￾ card ?￾m tr?￾n m?￾y Trong d?￾ng タu c?￾a s?￾ ki?￾n click, ta t タo m?￾t ?￾i t タ?￾ ng multimedia d タn xu タt t?￾ l?￾p MMedia ?￾y l?￾ b タ?￾c chuy?￾n t?￾ m?￾t l?￾p sang m?￾t ?￾i t タ?￾ng Private Sub Command1_Click() Dim Multimedia As New MMedia B?￾n d?￾ng kタ s?￾ d?￾ng ?￾i t タ?￾ng multimedia ?￾ m?￾ t タp tin d?￾ng ph タタng th?￾c mmOpen v?￾ Play b タng ph タタng th?￾c mmPlay If CommonDialog1.Filename "" Then Multimedia.mmOpen CommonDialog1.Filename Multimedia.mmPlay End If T タo l?￾p bao b?￾ c c?￾c API l?￾m v タn ?￾ タn gi タn h タn Nタu l?￾p n?￾y タ?￾c em th タタng m タi ho?￾, ng タ?￾i s?￾ d?￾ng n?￾ s タ kh?￾ ng c タn ph タi hi?￾u v?￾ API, h?￾ ch?￾ c タn biタt c?￾ch th?￾c ho タt ?￾ng c?￾a l?￾p m?￾ th?￾i T?￾m hi?￾u l?￾p Multimedia Windows c?￾ nhi?￾u ph?￾n h?￾, m?￾i ph?￾n h?￾ タm nhi?￾m m?￾t ch?￾c nng nh タt ?￾nh M?￾t nh?￾ ng ph タn n?￾y l?￾ MCI MCI l?￾ t?￾n g?￾i t タt c?￾a Multimedia Control Interface, cung c タp m?￾t gi タi ph?￾p ?￾c l タp v?￾i thiタt b?￾ ?￾ s?￾ d?￾ng c?￾c t?￾nh nng c?￾a Windows th?￾ng qua ch タタng tr?￾nh Khi viタt ch タタng tr?￾nh tr?￾ ch タi tr?￾n DOS, ta ph タi x?￾ l?￾ v?￾i nhi?￾u chu タn card ?￾m v?￾ h?￾nh タnh kh?￾c T?￾nh nng ?￾c l タp v?￾i thiタt b?￾, v?￾ c?￾c ch タタng tr?￾nh i?￾u khi?￾n thiタt b?￾ cung c タp b?￾i Windows cho ph?￾p ta l?￾m vi?￾c v?￾i b タt k?￾ card ?￾m thanh, h?￾nh タnh n?￾o v?￾i c?￾ng ch タタng tr?￾nh, mi?￾n l?￾ ch?￾ng タ?￾c h?￾ tr?￾ b?￾i Windows MCI cung c タp l?￾p ?￾m gi?￾a l タp tr?￾nh vi?￾n v?￾ c?￾c thiタt b?￾ d?￾ng x?￾ l?￾ d?￾ li?￾u multimedia nh タ c?￾c card ?￾m thanh, h?￾nh タnh MCI s タ l?￾m vi?￾c v?￾i c?￾c ch タタng tr?￾nh i?￾u khi?￾n thiタt b?￾ c?￾a Windows, v?￾ cu?￾i c?￾ng l?￾ ph タn c?￾ng multimedia L タp tr?￾nh vi?￾n, y?￾u c タu MCI d?￾ng h?￾m API mciSendString L?￾ nh n?￾y sau ?￾ タ?￾c g?￾i xu?￾ng ch タタng tr?￾nh i?￾u khi?￾n thiタt b?￾, ta kh?￾ng c タn quan t?￾m MCI l?￾ m?￾t ?￾i t タ?￾ ng ?￾c l タp N?￾ c?￾ th?￾ タ?￾c l タp tr?￾nh v?￾ c?￾ ng?￾n ng?￾ l タp tr?￾nh ri?￾ng Khi ta d?￾ng mciSendString, ta ang l タp tr?￾nh MCI S?￾ d?￾ng mciSendString C?￾ ph?￾p c?￾a mciSendString: = mciSendString( , _ , , ) l?￾ m?￾t s?￾ long integer, v?￾ thay ?￾i tu?￾ theo d?￾ng l?￾nh タt タu tr?￾ch d タn, ph タi l?￾ m?￾t t?￾ d タ?￾i d タng chu?￾i k?￾ t?￾ v?￾ l?￾ l?￾nh g?￾i タn MCI; nh タ l?￾ Play ?￾ play m?￾t t タp tin, Open ?￾ m タe t タp tin, v.v M?￾t s?￾ l?￾nh MCI tr タ v?￾ m?￾t chu?￾i k?￾ t?￾ L?￾nh Status tr タ v?￾ m?￾t chu?￾i cho biタt t タp tin d?￾ng h タn (Stopped), hay ang ch タi (Playing), hay d?￾ng t タm (Pause), v.v API c タn biタt bao nhi?￾u d?￾ li?￾u タ?￾c ch?￾a biタn chu?￾i, tham s?￾ kタ tiタp l?￾ chi?￾u d?￾i chu?￾i Do ?￾, nタu ta ph?￾t l?￾nh タn MCI tr タ v?￾ m?￾t chu?￾i, ta ph タi truy?￾n m?￾t biタn chu?￾i c?￾ chi?￾u d?￾i nh タt ?￾nh v?￾ cho biタt chi?￾u d?￾i c?￾a n?￾: Dim sReturnString As String * 255 Dim nReturn As Long nReturn = mciSendString("status waveaudio mode", _ sReturnString, 255, 0) Th?￾m * 255 v?￾o khai b?￾o sReturnString cho biタt chi?￾u d?￾i c?￾a n?￾ l?￾ 255 S?￾ d?￾ng h?￾m Callback Visual Basic H?￾m Callback th?￾c ch?￾ ?￾p d?￾ng cho C/C++, Delphi, hay m?￾t s?￾ ng?￾n ng?￾ bi?￾n d?￾ch c タp th タp, kh?￾ng d?￾ng v?￾i Visual Basic Tuy nhi?￾n, VB6 cho ph?￾p ta s?￾ d?￾ng h?￾m Callback m?￾ kh?￾ng c タn th?￾m c?￾c ch タタng tr?￾nh ph?￾ タc bi?￾t nh タ c?￾c phi?￾n b タn tr タ?￾c Khi ta d?￾ng API, ch タタng tr?￾nh c?￾a ta kh?￾ng th?￾ n?￾o biタt タ?￾c i?￾u g?￾ ang x タy h?￾m ang ch タy Ta ph タi ch?￾ タn n?￾ kタt th?￾c, v?￾ ki?￾m tra gi?￾ tr?￾ tr タ v?￾ ?￾ t タ?￾ng c?￾a h?￾m Callback l?￾ m?￾t API m?￾ ch タy, n?￾ c?￾ th?￾ g?￾i タn m?￾t h?￾m ho タc th?￾ t?￾c c?￾a ch タタng tr?￾nh ta ang viタt Ta ph タi t タo m?￾t h?￾m Public ?￾ m?￾t module ch タタng tr?￾nh c?￾a Visual Basic, v?￾i c?￾c tham s?￾ truy?￾n c タn thiタt c?￾a API Sau ?￾, g?￾i API, ta g?￾i m?￾t tr?￾ (pointer) - ?￾a ch?￾ v?￾ng nh?￾ c?￾a h?￾m Callback Ta ph タi d?￾ng to?￾n t?￾ m?￾i AddressOf: nResult = someAPIFunction(ParamOne, ParamTwo, _ AddressOf MyCallback) Khi API ch タy, n?￾ g?￾i mm?￾t h?￾m ch タタng tr?￾nh c?￾a ch?￾ng ta v?￾ g?￾i c?￾c tham s?￾ c タn thiタt Th タ?￾ng n?￾ タ?￾c タ?￾c d?￾ng ?￾ c タp nh タt tr タng th?￾i, l タy danh s?￾ch font h?￾ th?￾ng, v?￾ c?￾c c?￾ng vi?￾c kh?￾c Nh タ ?￾ n?￾ i, ch?￾ng ta s タ kh?￾ng n?￾i th?￾m v?￾ c?￾c h?￾m Callback C?￾c h?￾m n?￾y l?￾m ph?￾c t タp h タn cho ch タタng tr?￾nh v?￾ nhi?￾u l?￾m treo h?￾ th?￾ng Tuy nhi?￾n, tr?￾ gi?￾p c?￾a Visual Basic s タ cung c タp m?￾t s?￾ v?￾ d?￾ nタu b タn u?￾n t?￾m hi?￾u k?￾ h タn M?￾ t タp tin Media Ta g?￾i t?￾n t タp tin cho l?￾nh Open ?￾ m?￾ t タp tin ?￾y l?￾ t?￾n chu タn nh タ: C:\Video.avi Open Type Alias Issue command to something to the file Close Sau t?￾ kho?￾ Type l?￾ ki?￾u t タp tin Ki?￾u chu タn c?￾a Windows l?￾ WaveAudio ?￾i v?￾i t?￾p tin WAV, AVIVideo ?￾i v?￾i AVI, v?￾ Sequencer ?￾i v?￾i MID Alias d?￾ng ?￾ thay thタ t?￾n t タp tin m?￾: Open c:\video.avi Type AVIVideo Alias Peter Nタu ta g?￾i d?￾ng l?￾nh n?￾y タn MCI b タng MCISenString, n?￾ y?￾u c タu MCI m?￾ t タp tin C:\video.avi nh タ m?￾t t タp tin video c?￾a Microsoft, v?￾ n?￾ s タ d?￾ng t?￾n Peter ?￾ ch?￾ t タp tin n?￾y M?￾i l タn m?￾ t タp tin, l?￾nh MCI c?￾ th?￾ d?￾ng b?￾ danh ?￾ ch タi t タp tin, d?￾ng h タn hay t タm d?￾ng, ho タc hi?￾n th?￾ tr タng th?￾i, v.v V?￾ d?￾: Play Peter Pause Peter Stop Peter Sau ?￾, ta c タn ?￾ng t タp tin b タng c?￾ch g?￾i l?￾nh Close, theo sau l?￾ b?￾ danh c?￾a t タp tin nReturn = mciSendString( Close Peter , ,0,0) V?￾ d?￾ m タu - Hi?￾n th?￾ tr タng th?￾i v?￾ v?￾ tr?￾ c?￾a t タp tin Multimedia M?￾ ?￾ ?￾n TestMM.vbp Ch?￾ng ta s タ th?￾m m?￾t s?￾ i?￾u khi?￾n ?￾ xem thu?￾c t?￾nh Status v?￾ Position c?￾a l?￾p MMedia Th?￾m m?￾t i?￾u khi?￾n di?￾n tiタn (ProgressBar), m?￾t nh?￾n, m?￾t i?￾u khi?￾n ?￾ nh gi?￾ (timer): H?￾nh 9.5 Thiタt kタ bi?￾u m タu Nタu kh?￾ng th タy i?￾u khi?￾n ProgressBar tr?￾n h?￾p c?￾ng c?￾, t?￾ menu Project, ch?￾n Components, ch?￾n v?￾o h?￾p ?￾nh d タu Microsoft Windows Common Controls 6.0 M?￾ c?￾a s?￾ Properties c?￾a i?￾u khi?￾n Timer, ?￾i thu?￾c t?￾nh Enabled th?￾nh False, v?￾ Interval l?￾ 500 Xo?￾ Caption c?￾a i?￾u khi?￾n nh?￾n Nh タn ?￾p chu?￾t l?￾n n?￾t l?￾nh ?￾ m?￾ s?￾ ki?￾n Click: Private Sub Command1_Click() If CommonDialog1.Filename "" Then Multimedia.Wait = False Multimedia.mmOpen CommonDialog1.Filename ProgressBar1.Value = 0 ProgressBar1.Max = Multimedia.Length Timer1.Enabled = True Multimedia.mmPlay End If End Sub Tr?￾ v?￾ bi?￾u m タu, nh タn ?￾p chu?￾t l?￾n i?￾u khi?￾n Timer1 ?￾ m?￾ s?￾ ki?￾n Timer Private Sub Timer1_Timer() ProgressBar1.Value = Multimedia.Position Label1 = "Status: " & Multimedia.Status If ProgressBar1.Value = ProgressBar1.Max Then Multimedia.mmClose Timer1.Enabled = False End If End Sub C?￾ m?￾t v タn ?￾ nh?￾ Ta ?￾ ?￾nh ngh)a biタn ch?￾ タn instance c?￾a l?￾p MMedia h?￾m s?￾ ki?￾n command1_Click() B?￾y gi?￾ ch?￾ng ta l タi mu?￾n ch?￾ タn n?￾ t?￾ Timer1_Timer() GHI CH?￾ B タn s タ タ?￾c gi タi th?￾ch kh?￾i ni?￾m instance ch タ タng 13 - L タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng Trong s?￾ ki?￾n Click c?￾a n?￾t l?￾nh, ch?￾n d?￾ng khao b?￾o biタn Mutilmedia, nh タn ph?￾m Ctrl-X ?￾ c タt n?￾ v?￾o Clipboard v?￾ xo?￾ n?￾ kh?￾i s?￾ ki?￾n Command1_Click Sau ?￾, ch?￾n v?￾o danh s?￾ch (General) c?￾a s?￾ Code, nh タn ph?￾m Ctrl V ?￾ d?￾n n?￾ v?￾o v?￾ng General Declarations Biタn khai b?￾o タt v?￾ng n?￾y s タ l?￾ biタn to?￾n c?￾c ?￾i v?￾i bi?￾u m タu n?￾y Thi h?￾nh ch タ タng tr?￾nh Nh タn n?￾t Load and Play a file , v?￾ ch?￾n m?￾t t タptin AVI, v?￾ d?￾ t タp tin video Welcome to windows 95 Ta s タ th タy di?￾n tiタn cho th タy bao nhi?￾u ph タn trm c?￾a t タp tin ang ch タi Khi video kタt th?￾c ta th タy kタt qu タ hi?￾n th?￾: Stopped Khi ta m?￾i nh タn n?￾t l?￾nh, ch タタng tr?￾nh thiタt l タp c?￾c kh?￾i t タo cho thu?￾c t?￾nh tr タ?￾c ch タi t タp tin: If CommonDialog1.Filename "" Then Multimedia.Wait = False Multimedia.mmOpen CommonDialog1.Filename ProgressBar1.Value = 0 ProgressBar1.Max = Multimedia.Length Timer1.Enabled = True Multimedia.mmPlay End If ?￾i t タ?￾ng multimedia c?￾ thu?￾c t?￾nh t?￾n l?￾ Wait Thu?￾c t?￾nh n?￾y quyタt ?￾nh ch タタng tr?￾nh c?￾ tiタp t?￾c thi h?￾nh (a nhi?￾m) ch タi t タp tin, hay ph タi d?￾ng v?￾ ch?￾ タn タn n?￾ ho?￾n t タt Ph タタng th?￾c mmPlay theo d?￾i gi?￾ tr?￾ c?￾a biタn bWait Nタu biタn n?￾y c?￾ gi?￾ tr?￾ True, n?￾ th?￾m Wait v?￾o l?￾nh g?￾i mciSendString: Public Sub mmPlay() Dim nReturn As Long If sAlias = "" Then Exit Sub If bWait Then nReturn = mciSendString("Play " & _ sAlias & " wait", "", 0, 0) Else nReturn = mciSendString("Play " & sAlias, "", 0, 0) End If End Sub L?￾m biタt gi?￾ tr?￾ bWait ?￾ Nh タc l タi r タng ta c?￾ th?￾ cung c タp c?￾c h?￾m thu?￾c t?￾ nh cho ph?￾p ?￾c ho タc quy ?￾nh gi?￾ tr?￾ c?￾a biタn n?￾i b?￾: Property Get Wait() As Boolean ' Routine to return the value of the object's wait property Wait = bWait End Property Property Let Wait(bWaitValue As Boolean) ' Routine to set the value of the object's wait property bWait = bWaitValue End Property B タ?￾c kタ l?￾ m?￾ t タp tin ta mu?￾n ch タi Ta d?￾ng ph タタng th?￾c mmOpen ?￾ m?￾ t タp tin M?￾ t タp tin Tr タ?￾c hタt, ta khai b?￾o m?￾t c タp biタn c?￾c b?￾ ?￾ gi?￾ gi?￾ tr?￾ t タm th?￾i Public Sub mmOpen(ByVal sTheFile As String) Dim nReturn As Long Dim sType As String If sAlias "" Then mmClose End If Select Case UCase$ (Right$(sTheFile, 3)) Case "WAV" sType = "Waveaudio" Case "AVI" sType = "AviVideo" Case "MID" sType = "Sequencer" Case Else Exit Sub End Select sAlias = Right$(sTheFile, 3) & Minute(Now) If InStr(sTheFile, " ") Then sTheFile = Chr(34) & sTheFile & Chr(34) End if nReturn =mciSendString("Open " & sTheFile _ & " ALIAS " & sAlias & " TYPE " & sType _ & " wait", "", 0, 0) End Sub Tr タ?￾c hタt, h?￾m mmOpen ki?￾m tra biタn ?￾ m?￾c module g?￾i l?￾ sAlias If sAlias then mmClose End if L?￾m vi?￾c v?￾i MCI, ta n?￾n d?￾ng b?￾ danh cho t?￾ng t タp tin m?￾ ?￾ ?￾y l?￾p MMedia thiタt l タp m?￾t t?￾n cho b?￾ danh v?￾ ch?￾a b?￾ danh v?￾o biタn sAlias Khi ta tiタp t?￾c m?￾ m?￾t t タp tin kタ tiタp b タng mmOpen, ho タc ch?￾ thu?￾c t?￾nh t?￾n t タp tin, ch タタng tr?￾nh ki?￾m tra i?￾u n?￾y v?￾ g?￾i m?￾t th?￾ t?￾c kh?￾c ?￾ ?￾ ng t タp tin th?￾ nh タt ?￾ng t タp tin ta c タn gi タi ph?￾ng v?￾ng nh?￾ v?￾ tng t?￾c ?￾ ch タi t タp tin C タu tr?￾c Select Case ki?￾m tra t?￾ng lo タi t タp tin L?￾nh wait cho ph?￾p ch タタng tr?￾nh tiタp tuch ch タy cho タn n タp th?￾nh c?￾ng Nタu kh?￾ng c?￾ wait, tr?￾n m?￾t m?￾y nhanh v?￾i )a c?￾ng ch タm, c?￾ th?￾ c?￾ v タn ?￾ Ta c?￾ th?￾ c?￾ ch タi t タp tin tr タ?￾c n?￾ タ?￾c n タp xong, タn gi タn b?￾i v?￾ ch タタng tr?￾nh ch タy nhanh h タn )a c?￾ng L タu ?￾ r タng n?￾ kh?￾ng gi?￾ng thu?￾c t?￾nh Wait tr タ?￾c ?￾y ?￾ i?￾u khi?￾n ch タタng tr?￾nh tiタp t?￾c ch タy t タp tin ang ch タi ch?￾ kh?￾ng ph タi ang n タp L タy chi?￾u d?￾i t タp tin D?￾ng mciSendString ?￾ l タy ho タc quy ?￾ nh chi?￾u d?￾i Thu?￾c t?￾nh Length c?￾a l?￾p MMedia ch?￾ c?￾ t?￾nh ch タt タ?￾c ph?￾p ?￾c m?￾ th?￾i, v?￾ ta kh?￾ng cung c タp h?￾m Property Let Property Get Length() As Single Dim nReturn As Long, nLength As Integer Dim sLength As String * 255 If sAlias = "" Then Length = 0 Exit Property End If nReturn = mciSendString("Status " & sAlias _ & length", Length, 255, 0) nLength = InStr(sLength, Chr$(0)) Length = Val(Left$(sLength, nLength - 1)) End Property Tr タ?￾c hタt sAlias タ?￾c ki?￾m tra xem t タp tin c?￾ ang m?￾ hay kh?￾ng ?￾ Nタu ch タa m?￾, gi?￾ tr?￾ tr タ v?￾ t?￾ th?￾ t?￾c thu?￾c t?￾nh l?￾ 0 Nタu t タp tin m?￾ r?￾i, l?￾nh Status Length c?￾a MCI タ?￾c d?￾ng Ta kh?￾ng lo v?￾ c?￾ch t?￾nh chi?￾u d?￾i t タp tin, v?￾ タn v?￾ o ph?￾ h?￾p v?￾i di?￾ n tiタn L?￾nh Status l?￾ l?￾nh MCI タc bi?￾t, c?￾ th?￾ kタt n?￾i v?￾i c?￾c t?￾ kho?￾ nh タ Length, Position, Mode ?￾ x?￾ c ?￾nh c?￾c th?￾ng tin v?￾ t タp tin hi?￾n h?￾nh N?￾ tr タ v?￾ c?￾c th?￾ng tin n?￾y m?￾t chu?￾i k?￾ t?￾ c?￾ chi?￾u d?￾i nh タt ?￾nh タ?￾c truy?￾n v?￾o mciSendString Trong v?￾ d?￾ n?￾y chu?￾i tr タ v?￾ l?￾ sLength v?￾ d?￾i 255 k?￾ t?￾ D) nhi?￾n, n?￾ kh?￾ng lu?￾n ch?￾a 255 k?￾ t?￾ tr タ v?￾ t?￾ l?￾nh Status D?￾ng h?￾m InStr ?￾ c タt b?￾ c?￾c k?￾ t?￾ 0 l タp タy kho タng tr?￾ng Chi?￾u d?￾i ch?￾a chu?￾i タ?￾c tr?￾ch chu?￾i v?￾ chuy?￾n ?￾i sang ki?￾u s?￾ tr タ?￾c g?￾n cho Length L タy v?￾ tr?￾ hi?￾n h?￾nh L?￾nh Status Position c?￾ th?￾ タ?￾c g?￾i nhi?￾u l タn ?￾ x?￾c ?￾nh v?￾ tr?￾ hi?￾n h?￾nh c?￾a t タp tin ang ch タi: Property Get Position() As Single Dim nReturn As Integer, nLength As Integer Dim sPosition As String * 255 If sAlias = "" Then Exit Property nReturn = mciSendString("Status " & sAlias _ & " position", sPosition, 255, 0) nLength = InStr(sPosition, Chr$(0)) Position = Val(Left$ (sPosition, nLength - 1)) End Property Thay v?￾ g?￾i Status Length, ta g?￾i Status Position L タy tr タng th?￾i hi?￾n h?￾nh ?￾ l タy chu?￾i k?￾ t?￾ tr タng th?￾i c?￾n g?￾i l?￾ mode, ta truy v タn thu?￾c t?￾nh Status c?￾a l?￾p Ta cing s?￾ d?￾ng h?￾m thu?￾c t?￾nh Property Get h タu ?￾ng nh タt v?￾i thu?￾c t?￾nh Position tr?￾n ?￾y Ch?￾ kh?￾c l?￾ ta g?￾i Status Mode thay v?￾ Status Length hay Status Position cho mciSendString D) nhi?￾n, kh?￾ng c タn chuy?￾n ?￾i sang ki?￾u s?￾: nReturn = mciSendString("Status " & sAlias & _ " mode", sStatus, 255, 0) nLength = InStr(sStatus, Chr$(0)) Status = Left$(sStatus, nLength - 1) Tr?￾ l タi s?￾ ki?￾n Command1_Click Cho t?￾i gi?￾, ta ?￾ ?￾nh ngh)a thu?￾c t?￾nh Wait., m?￾ t タp tin, thiタt l タp di?￾n tiタn Tr タ?￾c ch タi t タp tin, ta quy ?￾nh Timer Sau ?￾, ta ch タi t タp tin b タng c?￾ch g?￾i ph タタng th?￾c mmPlay c?￾a ?￾i t タ?￾ng Multimedia If CommonDialog1.Filename "" Then Multimedia.Wait = False Multimedia.mmOpen CommonDialog1.Filename ProgressBar1.Value = 0 ProgressBar1.Max = Multimedia.Length Timer1.Enabled = True Multimedia.mmPlay End If Ch タi tr?￾n t タp tin Tr タ?￾c hタt, ki?￾m tra t タp tin m?￾ th?￾ng qua biタn sAlias; sau ?￾ nタu tho タ i?￾u ki?￾n, n?￾ thi h?￾nh l?￾nh Play c?￾a MCI Public Sub mmPlay() Dim nReturn As Long If sAlias = "" Then Exit Sub If bWait Then nReturn = mciSendString("Play " & _ sAlias & " wait", "", 0, 0) Else nReturn = mciSendString("Play " & _ sAlias, "", 0, 0) End If End Sub C タp nh タt di?￾n tiタn v?￾ i?￾u khi?￾n nh?￾n C?￾ng vi?￾c sau c?￾ng l?￾ c タp nh タt tr タng th?￾i v?￾ nh?￾n tr?￾n bi?￾u m タu, t タp tin ang ch タi Tr タ?￾c khich タi t タp tin, タt i?￾u khi?￾n Timer v?￾i Interval l?￾ 500 V タy n?￾ s タ k?￾ch ho タt タm m?￾i n?￾a gi?￾y Khi ?￾, o タn ch タタng tr?￾nh sau タ?￾c thi h?￾nh: Private Sub Timer1_Timer() ProgressBar1.Value = Multimedia.Position Label1 = "Status: " & Multimedia.Status If ProgressBar1.Value = ProgressBar1.Max Then Multimedia.mmClose Timer1.Enabled = False End If End Sub Cu?￾i c?￾ng c タn ph タi ng タng l タi タt タn cu?￾i t タp tin C?￾ th?￾ th?￾c hi?￾n i?￾u n?￾y b タng c?￾ch so s?￾ nh gi?￾ tr?￾ hi?￾n h?￾nh v?￾ gi?￾ tr?￾ Max c?￾a di?￾n tiタn Khi ch?￾ng b タng nhau, t タp tin タ?￾c ?￾ng b タng ph タタng th?￾c mmClose Sau ?￾, c タm Timer ?￾ ngn h?￾m n?￾y ch タy cho タn m?￾ t タp tin kh?￾c T?￾m t タt c?￾c l?￾nh c?￾a MCI L?￾nhM?￾ t タPlayCh タi m?￾t t タp tinPauseT タm d?￾ng ch タi, s タn s?￾ng b タt タu m?￾i l?￾ cStopD?￾ng h タn - c タn chuy?￾n タn m?￾t v?￾ tr?￾ n?￾o ?￾ ?￾ tiタp t?￾c ch タiSeekTheo sau l?￾ m?￾t s?￾, chuy?￾n タn v?￾ tr?￾ t タp tinStatus ModeTr タ v?￾ m?￾t chu?￾i k?￾ t?￾ th?￾ hi?￾n tr タng th?￾i t タp tin(ang choi, ang m?￾, t タm d?￾ng, d?￾ng h タn ) Status PositionTr タ v?￾ v?￾ tr?￾ t タp tin m?￾ playback ?￾ タt タnStatus LengthTr タ v?￾ chi?￾u d?￾i t タp tin v?￾ h?￾ tr?￾ ?￾ d タa s?￾ tr タ v?￾ t?￾ Status Position v?￾o m?￾t ng?￾ c タnh c?￾ ?￾ ngh)a n?￾o ?￾.Close?￾ng t タp tin v?￾ gi タi ph?￾ng v?￾ng nh?￾ n?￾ chiタm tr タ?￾c ?￾ Ngo?￾i MCI c?￾n h?￾ tr?￾ m?￾t s?￾ l?￾nh kh?￾c v?￾ m?￾t s?￾ l?￾nh タc bi?￾t cho m?￾i ?￾nh d タng t タp tin Th?￾m tr?￾ gi?￾p v?￾o ?￾ng d?￾ng Th?￾m h?￾ tr?￾ cho Help Th?￾m h?￾ tr?￾ cho Help v?￾o ?￾ng d?￾ng VB g タn nh タ kh?￾ タn gi タn T タt c タ nh?￾ng g?￾ ta c タn l?￾m l?￾ ch?￾ m?￾t thu?￾c t?￾nh, HelpFile (v?￾ d) nhi?￾n, viタt v?￾ bi?￾n d?￾ch t タp tin Help) ?￾ hi?￾n th?￾ Help ng タ?￾i s?￾ d?￾ng nh タn ph?￾m F1 hay y?￾u c タu Help t?￾ Menu M?￾t thu?￾c t?￾nh kh?￾c l?￾ HelpContextID, d?￾ng ?￾ cung c タp ch?￾ ?￾ Help theo ng?￾ c タnh cho b タt k?￾ giao di?￾n ng タ?￾i s?￾ d?￾ng n?￾o ch タタng tr?￾nh Qu?￾ tr?￾nh g タn th?￾m Help l?￾ nh タ c タ WinHelp v?￾ HTML Help Thu?￾c t?￾nh HelpFile Thu?￾c t?￾nh HelpFile c?￾a ?￾i t タ?￾ng App タ?￾c d?￾ng ?￾ ch?￾ t?￾n c?￾a t タp tin Help cho ?￾ng d?￾ng N?￾ ?￾i h?￾i m?￾t t タp tin h?￾p l?￾ c?￾a WinHelp (.hlp) ho タc l?￾ HTML Help (.chm) Nタu t タp tin kh?￾ng t?￾n t タi, l?￾i s タ x タy Ch?￾ thu?￾c t?￾nh HelpFile Ch?￾n Project Properties t?￾ menu Project ?￾ m?￾ h?￾p tho タi Project Properties Trong tr タ?￾ng Help File Name c?￾a tab General, g?￾ v?￾o タ?￾ng d タn v?￾ t?￾n c?￾a t タp tin Help c?￾a ?￾ng d?￾ng (.hlp hay.chm) Ta c?￾n c?￾ th?￾ ch?￾ HelpFile b タng c?￾ch l タp tr?￾nh o タn ch タタng tr?￾nh sau ?￾y ch?￾ m?￾t t タp tin HTML Help ch?￾a c?￾ng th タ m?￾c v?￾i t タp tin thi h?￾nh c?￾a ?￾ng d?￾ng: Private Sub Form_Load() App.HelpFile = App.Path & \foo.chm End Sub ?￾i t タ?￾ng ErrObject cing c?￾ thu?￾c t?￾nh HelpFile, cho ph?￾p ta ch?￾ m?￾t t タp tin Help kh?￾c cho c?￾c th?￾ng b?￾o l?￾i V?￾ d?￾, nタu ta c?￾ m?￾t v?￾i ?￾ng d?￾ng s?￾ d?￾ng chung c?￾c th?￾ng b?￾o l?￾i, ta c?￾ th?￾ タt Help cho c?￾c th?￾ng b?￾o l?￾i m?￾t t タp tin Help nh タt v?￾ g?￾i n?￾ b タng thu?￾c t?￾nh Err.HelpFile m?￾i ?￾ng d?￾ng Thu?￾c t?￾nh HelpContextID Thu?￾c t?￾ nh HelpContextID タ?￾c d?￾ng ?￾ li?￾n kタt m?￾t ph タn giao di?￾n ng タ?￾i s?￾ d?￾ng (nh タ l?￾ i?￾u khi?￾n, bi?￾u m タu hay menu) v?￾i m?￾t ch?￾ ?￾ li?￾n quan t タp tin Help Thu?￾c t?￾nh HelpContextID ph タi c?￾ ki?￾u l?￾ m?￾ t s?￾ Long t タタng ?￾ng v?￾i Context ID c?￾a m?￾t ch?￾ ?￾ t タp tin WinHelp (.hlp) hay HTML Help (.chm) V?￾ d?￾, ta c?￾ th?￾ nh タp 10000 v?￾o thu?￾c t?￾nh HelpContextID c?￾a h?￾p b タn Khi ng タ?￾i s?￾ d?￾ng ch?￾n h?￾p b タn v?￾ nh タn F1, VB t?￾m kiタm ch?￾ ?￾ c?￾ Context ID l?￾ 10000 t タp tin Help タ?￾c ch?￾ thu?￾c t?￾nh HelpFile c?￾a ?￾ng d?￾ng Nタu n?￾ t?￾m th タy, m?￾t c?￾a s?￾ Help s タ タ?￾c m?￾ v?￾ hi?￾n th?￾ ch?￾ ?￾; nタu kh?￾ng, l?￾i s タ xu タt hi?￾n v?￾ ch?￾ ?￾ m タc ?￾nh c?￾a t タp tin Help s タ タ?￾c hi?￾n th?￾ Ta n?￾n s?￾ d?￾ng HelpContextID nh タt cho m?￾i ch?￾ ?￾ Help t タp tin Help Trong m?￾t s?￾ tr タ?￾ng h?￾p, nタu mu?￾n, ta c?￾ th?￾ g?￾n c?￾ng HelpContextID cho m?￾t ?￾i t タ?￾ng nタu nh タ ch?￾ng s?￾ d?￾ng chung m?￾t ch?￾ ?￾ Help Ta kh?￾ng nh タt thiタt ph タi nh タp m?￾t HelpContextID cho m?￾i i?￾u khi?￾n tr?￾n bi?￾u m タu Nタu ng タ?￾i s?￾ d?￾ ng nh タn F1 tr?￾n i?￾u khi?￾n v?￾i HelpContextID 0 (gi?￾ tr?￾ m タc ?￾nh), VB s タ t?￾m kiタm m?￾t HelpContextID h?￾p l?￾ cho n タi ch?￾a c?￾a i?￾u khi?￾n G?￾n HelpContextID cho m?￾t i?￾u khi?￾n hay bi?￾u m タu Ch?￾n m?￾t i?￾u khi?￾n hay bi?￾u m タu m?￾ ta mu?￾n nh タp v?￾o HelpContextID Nh タn ?￾p HelpContextID c?￾a s?￾ Properties v?￾ g?￾ v?￾o gi?￾ tr?￾ Long h?￾p l?￾ Theo d?￾i gi?￾ tr?￾ m?￾ ta nh タp v?￾o cho ta c?￾ th?￾ d?￾ng c?￾ng gi?￾ tr?￾ ?￾ cho Context ID c?￾a ch?￾ ?￾ Help t タタng ?￾ng Ch?￾ ?￾: ?￾i v?￾i i?￾u khi?￾n CommonDialog v?￾ c?￾ l タ ?￾i v?￾i m?￾t s?￾ i?￾u khi?￾n kh?￾c, t?￾n c?￾a thu?￾c t?￾nh n?￾y l?￾ HelpContext thay v?￾ HelpContextID G?￾n HelpContextID cho menu Ch?￾n Menu Editor t?￾ menu Tools Ch?￾n m?￾c menu m?￾ ta mu?￾n nh タp v?￾o m?￾t HelpContextID Nh タp v?￾o m?￾t gi?￾ tr?￾ Long h?￾p l?￾ h?￾p Select the HelpContextID Theo d?￾i gi?￾ tr?￾ m?￾ ta nh タp v?￾o cho ta c?￾ th?￾ d?￾ng c?￾ng gi?￾ tr?￾ ?￾ cho Context ID c?￾a ch?￾ ?￾ Help t タタng h?￾p HelpContextID c?￾n c?￾ th?￾ タ?￾c nh タp v?￾o b タng c?￾ch l タp tr?￾nh: Private Sub Form_Load() Command1.HelpContextID = 12345 MenuHelp.HelpContextID = 23456 Err.HelpContext = 34567 End Sub Th?￾m h?￾ tr?￾ cho WHAT S THIS HELP VB cho ph?￾p ta th?￾m What s This Help v?￾o c?￾c ?￾ng d?￾ng m?￾ t c?￾ch d?￾ d?￾ng What s This Help cung c タp ph タn truy c タp nhanh タn b タn Help m?￾t c?￾a s?￾ b タt m?￾ kh?￾ng c タn ph タi m?￾ Help Viewer What s This Help ch?￾ yタu タ?￾c s?￾ d?￾ng ?￾ cung c タp tr?￾ gi?￾p タn gi タn cho c?￾c ph タn giao di?￾n ng タ?￾i s?￾ d?￾ng nh タ l?￾ c?￾c tr タ?￾ng d?￾ li?￾u nh タp VB h?￾ tr?￾ c?￾c ch?￾ ?￾ What s This Help c?￾c t タp tin WinHelp (.hlp) v?￾ HTML Help Vi?￾c g?￾n gi?￾ tr?￾ True cho thu?￾c t?￾nh WhatsThisHelp c?￾a bi?￾u m タu l?￾m cho What s This Help ho タt ?￾ng タ?￾c Khi ?￾, ph タn Help theo ng?￾ c タnh cho bi?￾u m タu s タ b?￾ v?￾ hi?￾u ho?￾ K?￾ch ho タt What s This Help cho bi?￾u m タu V?￾i bi?￾u m タu ?￾ タ?￾ c ch?￾n, nh タn ?￾p l?￾n thu?￾c t?￾nh WhatsThisHelp c?￾a s?￾ Properties ?￾ ?￾nh gi?￾ tr?￾ cho n?￾ l?￾ True C?￾i タt c?￾c thu?￾c t?￾nh sau ?￾y ?￾ th?￾m m?￾t n?￾t What s This v?￾o ti?￾u ?￾ c?￾a bi?￾u m タu: Thu?￾c t?￾nhC?￾i タtBorderStyle1-Fixed Single hay 2-SizableMaxButtonFalseMinButtonFalseWhatsThisButtonTrueCh?￾n m?￾t i?￾u khi?￾n m?￾ ta mu?￾n cung c タp What s This Helpv?￾ g?￾n m?￾t gi?￾ tr?￾ nh タt cho thu?￾c t?￾nh WhatsThisHelpID c?￾a i?￾u khi?￾n Theo d?￾i gi?￾ t?￾ m?￾ ta nh タp v?￾o cho ta c?￾ th?￾ d?￾ng c?￾ng gi?￾ tr?￾ ?￾ cho Context ID c?￾a ch?￾ ?￾ Help t タタng ?￾ng Ta cing c?￾ th?￾ cho ph?￾p What s This Help m?￾ kh?￾ng d?￾ng n?￾t What s This b タng c?￾ch ch?￾ thu?￾c t?￾nh WhatsThisHelp c?￾a bi?￾u m タu l?￾ True v?￾ g?￾i ph タタng th?￾c WhatThisMode c?￾a bi?￾u m タu hay ph タタng th?￾c ShowWhatThis c?￾a i?￾u khi?￾n Cung c タp help c?￾ng v?￾ i ?￾ng d?￾ng B タ?￾c cu?￾i c?￾ng vi?￾c th?￾m Help v?￾o ?￾ng d?￾ng l?￾ ch タc ch タn r タng n?￾ s タ タn tay ng タ?￾ i s?￾ d?￾ng C?￾c y?￾u c タu cho vi?￾c cung c タp Help c?￾ng v?￾i ?￾ng d?￾ng c?￾ h タi kh?￾c gi?￾a WinHelp v?￾ HTML Help Cung c タp WinHelp B?￾i v?￾ m?￾i h?￾ th?￾ng Windows ?￾u c?￾ c?￾i タt s タn Tr?￾nh xem Tr?￾ gi?￾p c?￾a Windows (Windows Help Viewer), ta ch?￾ c?￾n ph タi cung c タp t タp tin Help (.hlp) Tr?￾nh ?￾ng g?￾i v?￾ Tri?￾ n khai (Package and Deployment Wizard) t?￾ ?￾ng th?￾m c?￾c ph タn ph?￾ thu?￾c cho t タp tin Help タ?￾c tham chiタu b?￾i ?￾ng d?￾ng Nタu ta t タo ph タn c?￾i タt b タng c?￾c c?￾ng c?￾ kh?￾c, ta ph タi b タo タm r タng t タp tin.hlp タ?￾c タa v?￾o v?￾ タ?￾c c?￾i タt v?￾o ?￾ng v?￾ tr?￾ (th タ?￾ng l?￾ c?￾ng thu m?￾c v?￾i ?￾ng d?￾ng ho タc l?￾ th タ m?￾c Windows\Help) Cung c タp HTML Help HTML Help l?￾ m?￾t k?￾ thu タt t タタng ?￾i m?￾i, ?￾, ta kh?￾ ng th?￾ gi タ ?￾nh r タng m?￾i ng タ?￾i s?￾ d?￾ng ?￾ c?￾ nh?￾ng t タp tin c タn thiタt ?￾ xem HTML Help Tr?￾nh ?￾ng g?￾i v?￾ Tri?￾n khai (Package and Deployment Wizard) s タ th?￾m c?￾c ph タn li?￾n quan ?￾i v?￾i t タp tin HTML Help (.chm) タ?￾c tham chiタu b?￾i ?￾ng d?￾ng; nh タng n?￾ kh?￾ng th?￾m t タt c タ c?￾c ph タn li?￾n quan タn t タp tin HTML Help Viewer Ta c タn ph タi s?￾a l タi ph タn c?￾i タt ?￾ タa c?￾c t タp tin n?￾y v?￾o Tra c?￾u c?￾c t?￾i li?￾ u cho c?￾ng c?￾ HTML Help ?￾ hi?￾u th?￾m v?￾ c?￾c t タp tin n?￾o タ?￾c y?￾u c タu m?￾t t?￾nh hu?￾ng cho tr タ?￾ c L タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng Gi?￾i thi?￾u v?￾ ?￾i t タ?￾ng T?￾ タu quy?￾n タn gi?￾, ch?￾ng ta ch?￾ s?￾ d?￾ng biタn ?￾ ch?￾a nh?￾ng d?￾ li?￾u t タm th?￾i ?￾ng d?￾ng, ch タng h タn nh タ nh?￾ng gi?￾ tr?￾ ng タ?￾i s?￾ d?￾ng nh タp v?￾ o qua giao di?￾n Tuy nhi?￾n, ?￾y ch?￾ l?￾ m?￾t ph タn nh?￾ c?￾a VB VB th?￾c ch タt l?￾ m?￾t c?￾ng c?￾ l タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng r タt m タnh B タn c?￾ th?￾ cho r タng k?￾ thu タt n?￾y v タ?￾t qu?￾ kh タ nng m?￾t ng タ?￾i m?￾i h?￾c l タp tr?￾nh VB Tuy nhi?￾n, kh?￾ng h タn nh タ v タy L タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng (Object Oriented Programming OOP) gi?￾p l タp tr?￾nh d?￾ d?￾ng h タn C?￾c v?￾ d?￾ d?￾ng tr タ?￾c ?￾y タ?￾c l タp tr?￾nh theo ki?￾u l タp tr?￾nh c?￾ i?￾n i?￾u n?￾y kh?￾ng c?￾ g?￾ sai b?￾i v?￾ ?￾y l?￾ nh?￾ng ch タタng tr?￾nh nh?￾ v?￾ vi?￾c s?￾ d?￾ng OOP cho ch?￾ng cing kh?￾ng ph?￾ h?￾p V?￾i ki?￾u l タp t?￾nh c?￾ i?￾n, c?￾n g?￾i l?￾ Ph?￾t tri?￾n ph タn m?￾m theo c タu tr?￾c (Structured Software Development), ta ph タi x?￾c ?￾nh d?￾ li?￾u cing nh タ c?￾ch th?￾c ?￾ x?￾ l?￾ d?￾ li?￾u ?￾ng d?￾ng M?￾t giao di?￾n ng タ?￾i s?￾ d?￾ng タ?￾c cung c タp ?￾ hi?￾n th?￾ v?￾ nh タn d?￾ li?￾u t?￾ ng タ?￾i s?￾ d?￾ng, sau ?￾, c?￾ c h?￾m v?￾ th?￾ t?￾c タ?￾c x?￾y d?￾ng ?￾ th?￾c s?￾ x?￾ l?￾ d?￾ li?￾u i?￾u n?￾y c?￾ v タ タn gi タn ?￾ gi タi quyタt m?￾t v タn ?￾ l?￾n, ?￾ng d?￾ng chia th?￾nh nhi?￾u v タn ?￾ nh?￾ ?￾ gi タi quyタt m?￾t v タn ?￾ l?￾n, ?￾ng d?￾ng chia th?￾nh nhi?￾u v タn ?￾ nh?￾ ?￾ gi タi quyタt c?￾c h?￾m / th?￾ t?￾c OOP h タi kh?￾c m?￾t ch?￾t V?￾i l タp tr?￾nh c?￾ c タu tr?￾c, c?￾ ch th?￾c x?￾y d?￾ng ?￾ng d?￾ng, c?￾ch ch?￾ng kタt h?￾p ?￾ m?￾c ch タタng tr?￾nh r タt kh?￾c bi?￾t v?￾i th?￾c tタ cu?￾c s?￾ ng L タy m?￾t ?￾ng d?￾ng t?￾nh l タタng l?￾m v?￾ d?￾ Khi nh?￾n vi?￾n タ?￾c nh タn v?￾o l?￾m vi?￾c, c?￾c th?￾ng tin v?￾ nh?￾n vi?￾n ?￾ s タ タ?￾c nh タp v?￾o h?￾ th?￾ng t?￾nh l タタng S?￾ d?￾ng k?￾ thu タt l タp tr?￾nh c?￾ c タu tr?￾c, ta s タ d?￾ ng m?￾t bi?￾u m タu ?￾ ch?￾a c?￾c th?￾ng tin c?￾a nh?￾n vi?￾n v?￾ viタt ch タタng tr?￾nh ?￾ copy t タt c タ th?￾ng tin ?￾ nh タp v?￾o bi?￾u m タu ?￾ v?￾o CSDL ch?￾a ?￾ ?￾u ?￾ tr?￾n m タng c?￾ng ty ?￾ t タo phiタu tr タ l タタng, ta c タn c?￾ m?￾t bi?￾u m タu in phiタu tr タ l タタng cho ph?￾p NSD ch タタng tr?￾nh ch?￾n m?￾t nh?￾n vi?￾n s タ tr タ l タ タng, r?￾i viタt ch タタng tr?￾nh ?￾ thu th タp t タt c タ th?￾ng tin t?￾ CSDL v?￾ ?￾nh d タng n?￾ r?￾i タa m?￾y in Ta c?￾ th?￾ th タy r タng, gi タi ph?￾p n?￾y n タng v?￾ k?￾ thu タt v?￾ nghi?￾ng v?￾ x?￾ l?￾ m?￾y t?￾nh h タn l?￾ c?￾ch th?￾c hi?￾ n th?￾c tタ cu?￾c s?￾ng L タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng s タ l?￾m cho m?￾i chuy?￾n tr?￾ n?￾n タn gi タn h タn nhi?￾u V?￾i OOP, ta viタt m?￾t ch タタng tr?￾nh d?￾a tr?￾n c?￾c ?￾i t タ?￾ng c?￾a th?￾c tタ cu?￾c s?￾ng V?￾ d?￾, nタu ta ang viタt m?￾t ?￾ng d?￾ng t?￾nh l タタng, ?￾i t タ?￾ng m?￾ ta c タn l?￾m vi?￾c s タ l?￾ ph?￾ng ban v?￾ nh?￾n vi?￾n M?￾i ?￾i t タ?￾ng n?￾y c?￾ c?￾c thu?￾c t?￾nh: v?￾ d?￾, m?￾t nh?￾n vi?￾n c?￾ t?￾n v?￾ s?￾; m?￾t ph?￾ng ban c?￾ v?￾ tr?￾ v?￾ tr タ?￾ng ph?￾ ng Th?￾m v?￾o ?￾, c?￾ m?￾t s?￾ ph タタng th?￾c ?￾ ph?￾ng ph?￾t l タタng ?￾p d?￾ng cho c?￾c ?￾i t タ?￾ng tr?￾n - m?￾i th?￾ng m?￾t l タn, n?￾ quyタt ?￾nh ?￾p d?￾ng ph タタng th?￾c ph?￾t l タタng cho c?￾c ?￾i t タ?￾ng nh?￾n vi?￾n L タp tr?￾nh OOP cing t タタng t?￾ nh タ thタ: Ta quyタt ?￾nh ?￾i t タ?￾ng n?￾o l?￾ c タn thiタt, ?￾i t タ?￾ng c?￾ nh?￾ng thu?￾c t?￾nh n?￾o, v?￾ ta s タ ?￾p d?￾ng nh?￾ng ph タタng th?￾c n?￾o cho ?￾i t タ?￾ng Ta c?￾ th?￾ th タy r タng, ?￾y l?￾ gi タi ph?￾p hタt s?￾c g タn gii v?￾i nh?￾ng v タn ?￾ c?￾a th?￾c tタ cu?￾c s?￾ng m?￾ ta th タ?￾ng xuy?￾n g タp ph タi Nh?￾n vi?￾n タ?￾c xem l?￾ ?￾i t タ?￾ng m?￾t ?￾ng d?￾ng, v?￾ ph?￾ng ban l?￾ ?￾i t タ?￾ng c?￾ li?￾n quan v?￾i nh?￾n vi?￾n V?￾i l タp tr?￾nh c?￾ c タu tr?￾c, ta c?￾ xu h タ?￾ng xem d?￾ li?￾u v?￾ c?￾ch th?￾c x?￾ l?￾ d?￾ li?￾u l?￾ hai ph タn t?￾ch bi?￾t nhau, ho?￾n to?￾n kh?￾ c v?￾i c?￾c ?￾i t タ?￾ng v?￾ c?￾ch x?￾ l?￾ th?￾c tタ cu?￾c s?￾ng m?￾ ta v タn th タ?￾ng l?￾m V?￾i OOP, ta ?￾ng g?￾i d?￾ li?￾u v?￾ c?￾c ch?￾c nng x?￾ l?￾ d?￾ li?￾u m?￾t ?￾i t タタng (Object) gi?￾ng h?￾t v?￾i ?￾i t タ?￾ng th?￾c tタ cu?￾c s?￾ng Nh?￾n vi?￾n c?￾ t?￾n v?￾ ?￾a ch?￾, v?￾ v タy, ?￾y s タ l?￾ c?￾c thu?￾c t?￾nh c?￾a ?￾i t タ?￾ng Nh?￾n vi?￾n - d?￾ li?￾u Nh?￾ n vi?￾n c?￾ th?￾ タ?￾c nh タn vi?￾c v?￾ b?￾ u?￾i vi?￾c, v?￾ v タy, ?￾y s タ l?￾ c?￾c ph タタng th?￾c c?￾a ?￾i t タ?￾ng Nh?￾n vi?￾n ch?￾c nng B タng c?￾ch chia ?￾ng d?￾ng th?￾nh nhi?￾u ?￾i t タ?￾ng v?￾ ph?￾t tri?￾n tr?￾n c?￾c ?￾i t タ?￾ng, k?￾ thu タt n?￾y g タn gii h タn v?￾i ?￾i s?￾ng N?￾ gi?￾p t タo nh?￾ng ch タタng tr?￾nh d?￾ ?￾c d?￾ b タo tr?￾ K?￾ thu タt n?￾y cing l?￾ ch?￾n l?￾a c?￾a nhi?￾u c?￾ng ty l?￾n ph?￾t tri?￾n ph タn m?￾m ?￾i t タ?￾ng VB Nh タ v タy c?￾c l?￾ thuyタt tr?￾nh b?￾y tr?￾n ?￾y th?￾ hi?￾n nh タ thタ n?￾o VB?￾ Khi ta quyタt ?￾nh タt m?￾t h?￾p b タn v?￾o bi?￾u m タu, ta c?￾ ph タi g?￾i th?￾ t?￾c ?￾ t タo h?￾p b タn, m?￾t th?￾ t?￾c kh?￾c ?￾ タt h?￾p b タn v?￾o v?￾ tr?￾, r?￾i g?￾i m?￾t th?￾ t?￾c kh?￾c n?￾a ?￾ ?￾nh gi?￾ tr?￾ kh?￾i ?￾ng?￾ Ta c?￾ ph タi lu?￾n g?￾i m?￾t h?￾m m?￾i ng タ?￾i s?￾ d?￾ng nh タp m?￾t gi?￾ tr?￾ b タt k?￾ v?￾o h?￾p b タn?￾ D) nhi?￾n kh?￾ng ph タi nh タ v タy Nh?￾ng g?￾ ta c タn l?￾m l?￾ k?￾o v?￾ th タ m?￾t ?￾i t タ?￾ng (hay m?￾t i?￾u khi?￾n), ch タng h タn nh タ h?￾p b タn v?￾o bi?￾u m タu, r?￾i d?￾ng c?￾c thu?￾c t?￾nh ?￾ s?￾a ?￾i c?￾ch th?￾ hi?￾n ch?￾ng Khi ng タ?￾i s?￾ d?￾ng nh タp d?￾ li?￾u v?￾o h?￾p b タn, h?￾p b タn s タ th?￾ng b?￾o cho ta biタt th?￾ng qua c?￾c s?￾ ki?￾n Change v?￾ s?￾ ki?￾n KeyPress M タc d?￾ tr タ?￾c ?￾y, b タn kh?￾ ng nh タn i?￾u n?￾y, nh タng ?￾ m?￾t m?￾c ?￾ n?￾o ?￾, b タn ?￾ th?￾c hi?￾n l タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng r?￾i ?￾ Ngo?￾i c?￾c ?￾i tu?￾ng hay i?￾u khi?￾n タ?￾c cung c タp s タn, VB c?￾n cho ph?￾p l タp tr?￾nh vi?￾n t タo c?￾c ?￾i t タ?￾ng th?￾ ng qua c タ chタ modul l?￾p (Class module) Trong l?￾p Modul, ta ?￾nh ngh)a c?￾c thu?￾c t?￾nh v?￾ ph タタng th?￾ c c?￾a m?￾t ?￾i t タ?￾ng Sau ho?￾n t タt, ?￾ s?￾ d?￾ng ?￾i t タ?￾ng, tr タ?￾c hタt, ta t タo ?￾i t タ?￾ng v?￾ g?￾i c?￾c h?￾m / th?￾ t?￾c modul l?￾p C?￾c ?￾i t タ?￾ng n?￾y c?￾ m?￾t s?￾ タc t?￾nh chung: T?￾ng ?￾i t タ?￾ng ph タi c?￾ ch?￾c nng t?￾ ng qu?￾t, タ?￾c ?￾nh ngh)a v?￾a ?￾ ?￾ hi?￾u nh タng kh?￾ m?￾m d タo ?￾ c?￾ th?￾ s?￾ d?￾ng タ?￾c; nh タng cho ph?￾p ph?￾t tri?￾n th?￾m tu?￾ theo y?￾u c タu V?￾ d?￾, m?￾t n?￾t l?￾nh ph タi c?￾ ch?￾c nng chung l?￾ nh タn v?￾o ?￾ thi h?￾nh m?￾t c?￾ ng vi?￾c g?￾ ?￾ Tuy nhi?￾n, c?￾ch th?￾ hi?￾n v?￾ ho タt ?￾ng c?￾a n?￾ t?￾ng tr タ?￾ng h?￾p c?￾ th?￾ thay ?￾i ch?￾t ?￾t tu?￾ theo c?￾ch ta c?￾i thu?￾c t?￾nh v?￾ viタt code cho ph タタng th?￾c ?￾ ph タn ?￾nh v?￾i s?￾ ki?￾n ?￾i t タ?￾ng giao tiタp b?￾ n ngo?￾i th?￾ng qua thu?￾c t?￾nh, ph タタng th?￾c, v?￾ s?￾ ki?￾n タ?￾c ?￾nh ngh)a tr タ?￾c cho n?￾ T?￾ h?￾p c?￾a kh?￾i ni?￾m n?￾y g?￾i l?￾ giao di?￾n (Interface) ?￾ l?￾ nh?￾ng yタu t?￾ c タn biタt v?￾ m?￾t ?￾i t タ?￾ng ?￾ s?￾ d?￾ng ch?￾ng C?￾ th?￾ s?￾ d?￾ng nhi?￾u ?￾i t タ?￾ng m?￾t ?￾ ?￾n, ta cing c?￾ nhi?￾u th?￾ hi?￾n kh?￾c c?￾a m?￾t ki?￾u ?￾i t タ?￾ng Ng タ?￾i s?￾ d?￾ng ?￾i t タ?￾ng kh?￾ng c タn quan t?￾m タn c?￾ch l タp tr?￾nh b?￾n ?￾i t タ?￾ng B?￾i v?￾ ng タ?￾i s?￾ d?￾ ng ch?￾ th タy ?￾i t タ?￾ng i?￾u khi?￾n, ta c?￾ th?￾ thay ?￾i ho タt ?￾ng b?￾n c?￾a ?￾i t タ?￾ng cho nh?￾ng thay ?￾i n?￾y kh?￾ng タnh h タ?￾ng タn ?￾ng d?￾ng ang d?￾ng, ngh)a l?￾ kh?￾ng thay ?￾i Interface Modul L?￾p Khu?￾n m タu ?￾ t タo ?￾i t タ?￾ng l?￾ modul l?￾p Sau n?￾y, modul l?￾p c?￾n タ?￾c d?￾ng ?￾ t タo i?￾u khi?￾n ActiveX, m?￾t k?￾ thu タt cao h タn c?￾a l タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng Trong b タ?￾c l タp tr?￾nh cn b タn v?￾i VB, ta dung modul ?￾ ch?￾a c?￾c h?￾m hay th?￾ t?￾c Tu?￾ theo t タm ho タt ?￾ng c?￾a h?￾m / th?￾ t?￾c n?￾y, ta c?￾ th?￾ g?￾i ch?￾ng tr?￾c tiタp t?￾ modul Nh タng modul l?￾p th?￾ kh?￾ng bao gi?￾ タ?￾c g?￾i tr?￾c tiタp ?￾ s?￾ d?￾ng m?￾t l?￾p, ta ph タi t タo ?￾i t タ?￾ng t?￾ l?￾p th?￾ng qua l?￾nh New ?￾ ?￾y ?￾i t タ?￾ng タ?￾c t タo t?￾ l?￾p MyClass, c?￾n biタn ?￾i t タ?￾ng MyObject cung c タp m?￾t tham chiタu タn ?￾i t タ?￾ng Dim MyObject As New myClass D?￾ng l?￾nh tr?￾n t タo m?￾t ?￾i t タ?￾ng g?￾i l?￾ MyObject theo m?￾ t タ c?￾a l?￾p MyClass H?￾nh ?￾ng n?￾y g?￾i l?￾ t タo m?￾t Instance t?￾ l?￾p.Trong c?￾a s?￾ Properties, ta c?￾ th?￾ ph?￾n bi?￾t t?￾n l?￾p v?￾ t?￾n ?￾i t タ?￾ng Combo1 l?￾ t?￾n ?￾i t タ?￾ng, ComboBox l?￾ t?￾n l?￾p Ta c?￾ th?￾ t タo v?￾ s?￾ Instance t?￾ m?￾t l?￾p M?￾i Instance c?￾ th?￾ kh?￾c m?￾t ch?￾t tu?￾ theo c?￾ch ta quy ?￾nh thu?￾c t?￾nh v?￾ s?￾ d?￾ng ph タタng th?￾c Thu?￾c t?￾nh v?￾ ph タタng th?￾c c?￾a l?￾p B?￾n m?￾t l?￾p, ta c?￾ th?￾ t?￾c ph タタng th?￾c (Method Procedures) v?￾ th?￾ t?￾c thu?￾c t?￾nh (Property Procedures) Quy ?￾nh m?￾t thu?￾c t?￾nh, ngh)a l?￾ ta ang g?￾i h?￾m x?￾ l?￾ s?￾ ki?￾n Property Let Trong VB4, modul l?￾p c?￾n r タt th?￾ s タ タn VB5, n?￾ b タt タu h?￾ tr?￾ g タn gii h タn cho l タp tr?￾nh h タ?￾ng ?￾i t タ?￾ng V?￾ d?￾: ta c?￾ th?￾ t タo nh?￾ng i?￾u khi?￾n c?￾ th?￾ kタt h?￾p m?￾i tr タ?￾ng ph?￾t tri?￾n VB (v?￾ nh?￾ng ng?￾n ng?￾ kh?￾c) Thu?￾c t?￾nh c?￾a ch?￾ng hi?￾n th?￾ c?￾a s?￾ Properties, nh?￾ng s?￾ ki?￾n c?￾a ch?￾ng xu タt hi?￾n danh s?￾ch th タ xu?￾ng ch?￾a c?￾ s?￾ Code Trong VB6, phi?￾n b タn Professional v?￾ Enterprise h?￾ tr?￾ Tr?￾nh x?￾y d?￾ng L?￾p (Class Builder) gi?￾p l タp tr?￾nh vi?￾n l?￾m vi?￾c r タt d?￾ d?￾ng v?￾i l?￾p N?￾ cung c タp m?￾t lo タt c?￾c h?￾p tho タi, h タ?￾ ng d タn ta t?￾ng b タ?￾c ?￾ t タo l?￾p Tuy nhi?￾n, v?￾ d?￾ n?￾y, ?￾ hi?￾u t?￾ ch?￾c m?￾t l?￾p, ta s タ t タo b タng tay V?￾ d?￾ m タu - Thiタt kタ l?￾p c?￾ ch?￾c ng di chuy?￾n h?￾p tr?￾n m?￾n h?￾nh: T タo ?￾ ?￾n m?￾i, ki?￾u Standard EXE T?￾ menu Project, ch?￾n Add Class Module Ch?￾n Class Module v?￾ nh タn Open C?￾a s?￾ Code s タ hi?￾ n th?￾ Nタu nh?￾n v?￾o c?￾a s?￾ Project Explorer, ta s タ th タy m?￾t l?￾p m?￾i xu タt hi?￾n V?￾ ta mu?￾n t タo m?￾t l?￾ p Box, n?￾n ta ?￾i t?￾n l?￾p Class1 cho g?￾i nh?￾: clsBox C?￾m t?￾ cls th?￾ hi?￾n ?￾y l?￾ l?￾p, nh?￾ ?￾, ch タタng tr?￾ nh tr?￾ n?￾n d?￾ ?￾c h タn ?￾ th?￾c hi?￾n i?￾u n?￾y, t?￾m l?￾p Class1 c?￾a s?￾ Properties, ?￾i thu?￾c t?￾nh Name c?￾a n?￾ th?￾nh clsBox Thu?￾c t?￾nh c?￾a L?￾p Public v?￾ Private L?￾p Box c?￾ thu?￾c t?￾nh l?￾ to タ ?￾ g?￾c tr?￾i tr?￾n (X,Y), chi?￾u cao (Height) v?￾ chi?￾u r?￾ng (Width) B?￾y gi?￾ ta c タn khai b?￾o c?￾c thu?￾c t?￾nh tr?￾n l?￾ Public hay Private Khi m?￾t thu?￾c t?￾nh タ?￾c khai b?￾o l?￾ Public m?￾t l?￾p, n?￾ s タ タ?￾c s?￾ d?￾ng b?￾i b タt k?￾ o タn ch タタng tr?￾nh n?￾o c?￾ s?￾ d?￾ng l?￾p n?￾y Tr?￾i l タi, nタu thu?￾c t?￾nh l?￾ Private m?￾t l?￾p th?￾ n?￾ s タ kh?￾ng タ?￾c truy c タp b?￾i b タt c?￾ o タn ch タタng tr?￾nh n?￾o kh?￾c Ta th?￾ t?￾m hi?￾u v?￾ thu?￾c t?￾nh Public So s?￾nh c?￾ch khai b?￾o c?￾a m?￾t thu?￾c t?￾nh Public v?￾i m?￾t biタn Public ?￾ ?￾y, biタn Public m?￾t l?￾p gi?￾ng nh タ m?￾t biタn Public b タt k?￾ n?￾o kh?￾c, ch?￾ c?￾ i?￾u l?￾ ta x?￾ l?￾ n?￾ ch タタng tr?￾nh th?￾ gi?￾ng nh タ ta ang x?￾ l?￾ v?￾i m?￾t thu?￾c t?￾nh V?￾ d?￾, nタu ta khai b?￾o thu?￾c t?￾nh X l?￾ m?￾t biタn Public, sau ?￾, khai b?￾o m?￾t ?￾i t タ?￾ng g?￾i l?￾ MyBox d?￾a tr?￾n l?￾p n?￾y, ta c?￾ d?￾ng l?￾nh sau: MyBox.X = 1000 Tham chiタu タn X t タタng t?￾ nh タ ta x?￾ l?￾ v?￾i m?￾t thu?￾c t?￾nh th?￾ng th タ?￾ng tr?￾n c?￾c ?￾i t タ?￾ng ho タc i?￾u khi?￾n b タt k?￾ kh?￾c Nh タng nh?￾ng g?￾ ch?￾ng ta l?￾m l?￾ cho ph?￾p ng タ?￾i s?￾ d?￾ng ?￾i t タ?￾ng c?￾a ch?￾ng ta ?￾i X th?￾nh gi?￾ tr?￾ m?￾ h?￾ mong mu?￾n B?￾y gi?￾ ta s タ khai b?￾o X l?￾ thu?￾c t?￾nh Public, n?￾ cing t タタng t?￾ Nh タng n?￾ cing kh?￾ ng gi?￾ng h タn ?￾i v?￾i thu?￾c t?￾nh Public, m?￾i n?￾ b?￾ ?￾i gi?￾ tr?￾, m?￾t o タn ch タタng tr?￾nh b?￾n l?￾p s タ thi h?￾nh Trong o タn ch タタng tr?￾nh n?￾y, ta c?￾ th?￾ quyタt ?￾nh ta mu?￾n gi?￾ tr?￾ n?￾o ?￾ m?￾ ng タ?￾i s?￾ d?￾ng ch?￾ ra, v?￾ nタu kh?￾ng th?￾ l?￾m m?￾t t?￾c v?￾ g?￾ ?￾ Do ?￾, s?￾ kh?￾c gi?￾a biタn v?￾ thu?￾c t?￾nh l?￾: thu?￾c t?￾nh lu?￾n c?￾ m?￾t o タn ch タタng t?￾nh ch タy b?￾n m?￾i n?￾ タ?￾c truy c タp D?￾ng thu?￾c t?￾nh thay cho biタn cing h タn chタ kh タ nng sai s?￾t v?￾ gi?￾ tr?￾ truy?￾n v?￾o l?￾p タ?￾c ki?￾m nghi?￾m nh?￾ o タn ch タタng tr?￾nh ki?￾m tra b?￾n l?￾p Trong th?￾c tタ, thu?￾c t?￾nh h?￾u d?￾ng h タn biタn v?￾ ?￾i ta c タn m?￾t x?￾ l?￾ h タn l?￾ ch?￾ g?￾n gi?￾ tr?￾ V?￾ d?￾, ?￾i thu?￾c t?￾nh Color c?￾a m?￾t h?￾p b タn hi?￾u ch?￾nh l?￾m n?￾ ?￾i m?￾u tr?￾n m?￾n h?￾nh ?￾y l?￾ m?￾t t?￾c v?￾ kh?￾ng th?￾ th?￾c hi?￾n タ?￾c v?￾i biタn o タn ch タタng tr?￾nh b?￾n s タ g?￾i m?￾t ph タタng th?￾c ?￾ thi h?￾nh t?￾c v?￾ n?￾y V?￾ d?￾ m タu Th?￾m thu?￾c t?￾nh v?￾o l?￾p Ta khai b?￾o biタn ?￾ ch?￾a gi?￾ tr?￾ thu?￾c t?￾ nh Option Explicit Private mvarX As Integer Biタn n?￾y c?￾ t タm ho タt ?￾ng b?￾n modul l?￾p Th?￾m ch タタng tr?￾nh v?￾o thu?￾c t?￾nh X: Public Property Let X(ByVal vData As Integer) mvarX = vData End Property Public Property Get X() As Integer X = mvarX End Property o タn ch タタng tr?￾nh n?￾y kh?￾ng thi h?￾nh tr?￾c tiタp tr?￾ phi n?￾ タ?￾c g?￾i th?￾ng qua thu?￾c t?￾nh ?￾i t タ?￾ng Dim MyBox As New clsBox MyBox.X = 100 Khi ta g?￾n gi?￾ tr?￾ 100 cho thu?￾c t?￾nh X, th?￾c ch タt, ta ang g?￾i th?￾ t?￾c Property Let X: Public Property Let X(ByVal vData As Integer) mvarX = vData End Property Gi?￾ tr?￾ 100 truy?￾n cho tham s?￾ vData Sau ?￾, n?￾ タ?￾c g?￾n cho biタn c?￾c b?￾ mvarX, ngh)a l?￾ thu?￾c t?￾nh ?￾ タ?￾c thay ?￾i v?￾ ch?￾a v?￾o ?￾i t タ?￾ ng ?￾ xem gi?￾ tr?￾ thu?￾c t?￾nh, ta g?￾i: New_Position = MyBox.X Ngh)a l?￾ th?￾ t?￾c Property Get X thi h?￾nh: Public Property Get X() As Integer X = mvarX End Property Th?￾ t?￾c Property Let タ?￾c g?￾i ?￾i gi?￾ tr?￾ thu?￾c t?￾nh Gi?￾ tr?￾ ?￾i s タ タ?￾c ch?￾a v?￾o m?￾t biタn c?￾c b?￾ b?￾n l?￾p Th?￾ t?￾c Property Get タ?￾c g?￾i c タn ?￾c gi?￾ tr?￾ thu?￾c t?￾nh Gi?￾ tr?￾ ch?￾a biタn c?￾c b?￾ タ?￾c tr タ v?￾ Property Get Tuy nhi?￾n, hai th?￾ t?￾c thu?￾c t?￾nh n?￾y ch?￾ l?￾m vi?￾c v?￾i c?￾c ki?￾u d?￾ li?￾u c タ b タn nh タ Variant, String, Integer ?￾i v?￾i thu?￾c t?￾nh ch?￾a ?￾i t タ?￾ng, thay v?￾ d?￾ng Property Let, ta d?￾ng Property Set V?￾ d?￾: Public Property Set Font (Byval New_Font As stdFont) Set mvarFont = New_Font End Property ?￾ ?￾nh thu?￾c t?￾nh Font c?￾a ?￾i t タ?￾ng MyObject t?￾ ?￾ng d?￾ng, ta g?￾i cho n?￾ ?￾i t タ?￾ng Font myFont Tuy nhi?￾n, ?￾ タm b タo VB d?￾ng th?￾ t?￾c Property Set, ta タt t?￾ kho?￾ Set tr タ?￾c thu?￾c t?￾nh: Dim myFont As New StdFont myFont.Name= Courier myFont.Bold=True Set MyObject.Font = myFont T タタng t?￾, ta ho?￾n t タt c?￾c thu?￾c t?￾nh c?￾n l タi c?￾a l?￾p clsBox Trong ph タn General Declarations, th?￾m c?￾c biタn c?￾c b?￾ Option Explicit Private mvarY As Integer Private mvarWidth As Integer Private mvarHeight As Integer Th?￾m c?￾c th?￾ t?￾c tiタp theo: Public Property Let Y(ByVal vData As Integer) mvarY = vData End Property Public Property Get Y() As Integer Y = mvarY End Property Public Property Let Width(ByVal vData As Integer) mvarWidth = vData End Property Public Property Get Width() As Integer Width = mvarWidth End Property Public Property Let Height(ByVal vData As Integer) mvarHeight = vData End Property Public Property Get Height() As Integer Height = mvarHeight End Property L タu modul th?￾nh t タp tin clsBox.cls タn ?￾y, ta c タn ph タタng th?￾c n?￾a l?￾ v タ h?￾p (DrawBox) v?￾ xo?￾ h?￾p (ClearBox) C タ ph タタng th?￾c c?￾ m?￾t tham s?￾ truy?￾n l?￾ ?￾i t タ?￾ng ?￾ v タ h?￾p l?￾n N?￾ c?￾ th?￾ l?￾ bi?￾u m タu, h?￾p h?￾nh Ph タタng th?￾c c?￾a L?￾p V?￾ d?￾ m タu Th?￾m ph タタng th?￾c cho l?￾p Th?￾m o タn ch タタng tr?￾nh sau v?￾o modul l?￾p: Public Sub DrawBox(Canvas As Object) Canvas.Line (mvarX, mvarY)-(mvarX + mvarWidth, mvarY + mvarHeight),, B End Sub o タn ch タタng tr?￾nh n?￾y s?￾ d?￾ ... Label1.Caption = Time End Sub C?￾c t?￾nh nng m?￾i Visual basic 6.0 Kh?￾i qu?￾t v タn t タt v?￾ Visual basic 6.0 Nタu b タn ch タa quen v?￾i Visual basic, t?￾a ?￾ c?￾a ph タn n?￾y c?￾ th?￾ l?￾m nh タm... explorer Visual basic gi?￾p qu タn l?￾ v?￾ ?￾nh h タ?￾ng nhi?￾u ?￾ ?￾n Visual basic cho ph?￾p t?￾ ch?￾c nhi?￾u ?￾ ?￾n m?￾t nh?￾m g?￾i l?￾ project group Ta c?￾ th?￾ l タu t タp h?￾p c?￾c ?￾ ?￾n Visual basic. .. Enviroment; nh タn OK IDE c?￾a Visual basic s タ ?￾ nh l タi c タu h?￾nh cho hi?￾n th?￾ SDI l タn kh?￾i ?￾ng tiタp sau c?￾a Visual basic Nh タn OK, tho?￾t v?￾ kh?￾i ?￾ng l タi Visual basic Tr?￾ gi?￾p Kh?￾ng

Ngày đăng: 16/04/2014, 16:20

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w