0 calificaciones0% encontró este documento útil (0 votos)
603 vistas63 páginas
Este documento contiene información sobre Visual Basic 6.0. Explica los componentes principales de la interfaz de desarrollo integrada de Visual Basic como el proyecto, la barra de menús, la caja de herramientas y la ventana de formulario. También define conceptos clave como objetos, propiedades, eventos y métodos. Además, incluye ejemplos de código para crear una interfaz gráfica básica y manipular eventos y propiedades de controles.
Este documento contiene información sobre Visual Basic 6.0. Explica los componentes principales de la interfaz de desarrollo integrada de Visual Basic como el proyecto, la barra de menús, la caja de herramientas y la ventana de formulario. También define conceptos clave como objetos, propiedades, eventos y métodos. Además, incluye ejemplos de código para crear una interfaz gráfica básica y manipular eventos y propiedades de controles.
Este documento contiene información sobre Visual Basic 6.0. Explica los componentes principales de la interfaz de desarrollo integrada de Visual Basic como el proyecto, la barra de menús, la caja de herramientas y la ventana de formulario. También define conceptos clave como objetos, propiedades, eventos y métodos. Además, incluye ejemplos de código para crear una interfaz gráfica básica y manipular eventos y propiedades de controles.
Modul I KONESIMENTO GERAL PROGRAMASAUN VISUAL BASIC 6.0
1. Intrudusaun Visual Basic nee hanesan lian programasaun komputador nian. Lian programasaun mak instrusaun sira nebe bele kompriende husi komputador atu halo servisu espesifiku ruma. Lian programasaun Visual Basic dezemvolve husi Microsoft iha tinan 1991, nebe sei kontinuasaun dezemvolve, sai hanesan lian programasaun BASIC (Beginner,s) All-purpose Symbolic Instruction Code) nebe dezenvolve iha 1950 i tal. Visual Basic henesan Develompent Tool ida, mak intrumento auxiliar ida nebe bele ajuda ita atu halo (kria) programa komputador nian oin-oin, especialmente ba komputador sira nebe mak utiliza sistema operativo windows. Visual basic mos hanesan lian programasaun komputador nian ida nebe bele suporta objeto (Object Oriented Programming = OOP).
2. Integrated Development Integration (IDE), (ambiente servisu visual basic nian) Atu hahu ka ativu programa visual basic 6.0 liu husi butaun menu Start > All Programs > Microsoft Visual Studio 6.0 > Microsoft Visual Basic 6.0, hein too mosu jenela hanesan tuir mai nee :
Husi jenela nebe iha leten ba hili Standart EXE no klika iha butaun Open, hafoin sei hamosu ambiente servisu visual basic nian ka IDE, hanesan tuir mai nee :
Deskripsaun kompnente husi Visual Basic : 1. Project : konjunto modulo/programa aplikasaun VB nian rasik nebe sei rai ho extensaun ficeiro .VBP nebe sei priense husi Form sira. 2. Menubar : iha komponente/parte ida nee sei iha menu basiku sira nebe sei utiliza durante kria programa ruma. 3. Toolbar : iha parte sei hamosu ikon sira husi menu principal nebe mak iha menubar, hanesan imagen tuir mai nee :
4. Toolbox : iha parte ida nee sei komposto husi icon sira/ komponete sira atu hatama objeto espesifiku ruma ba iha form laran waihira iha dezeno programa ruma. July 19, 2014 PRATIKA VISUAL BASIC 6.0
5. Janela Formulario (Form) : area/ambiente ida nebe mak iha relasaun ho jenela ida nebe bele haree wainhira aplikasaun lao. Iha form nee mak bele tau kontrolo no kodigu sira atu kria programa.
6. Janela kodigu : atu hakerek source code husi programa nebe mak ita sei halo/kria. Code Editor
7. Project Explorer : sei hamosu form sira no modul nebe iha programa nia laran nebe ita halo. Ho project explorer ita bele muda husi form ida ba form seluk.
Deskripsaun : 1. Project Visual Basic 2. View Code : atu haree janela editor program 3. View Object :atu haree janela formulario 4. Toggle Folders : atu hare pasta rai ficheiro ba. 5. Form nebe ativo hela. 8. Janela Propriedade/properties : atu kontrola propriedade husi form.
Kontrolo sira iha propriedade nee iha mudansa tuir form ka kontrolo nebe ita hili no presiza.
9. Jenela Form Layout : atu kontrola pozisaun form iha monitor waihira halao exekusaun ba programa (runing program). 3. Object, Property, Event no Method Iha programasaun orientada objetos (OOP), ita prensiza hatene kona ba termo Object, Property, Event no Method : Object : komponente nebe iha programa ida nia laran Property : karateristika husi object Event : eventu/akontesimentu Method : aksaun 4. Ilustrasaun ba Object, Property, Event no Method Exemplo ida husi ilustrasaun ida nee,ita bele kompara ho motor ida nebe sai hanesan objeto (object) ida nebe iha Property, Event no Method. Atensaun ba imajen tuir mai nee :
Object : Motor Property : Marka (Yamaha ), Tipe (Vixion), Koor : Metan Method : Ba oin, Ba kotuk no Para/stop Event : Gas, Dudu no Xoke
MODULO II HAHU PRATIKA DEZENHO PROGRAMA IHA VISUAL BASIC HO FORM NO KODING OU LISTING PROGRAMA PRATIKA VISUAL BASICO HO NIA MANEIRA NEBEE HAU PREPARADU TIHA ONA
Atu Desenhu Iha Form nia Laran ihat persiza konponenti hirak nebee ita uza hodi desenhu iha form nia laran mak hanesan; label 1 & label 2 no iha command 1, 2, & 3 mak nia desenhu hanesan iha ona okos nee.
Klik iha komandu 2 balik nia leten mak mosu hanesan iha okos nee;
Klik dalarua iha command1 nia laran hafoin ita tau ninia kode hanesan tuir mai nee no iha tan command 2 & 3 mak nia exemplo hanesan tuir mai nee: Listing Program
Halo align font style & font color mak ita persiza design hanesan tuir mai nee;
Antes ita atu tau kode hirak nebee hanesan tuir mai nee, ita klik dalarua iha check box nia leten mak ita hafoin hatama kode listing program; KODE LISTING Private Sub Check1_Click() Label1.FontBold = Check1.Value Label2.FontBold = Check1.Value Label3.FontBold = Check1.Value End Sub
Private Sub Check2_Click() Label3.FontItalic = Check2.Value Label1.FontItalic = Check2.Value Label2.FontItalic = Check2.Value End Sub Private Sub Check3_Click() Label3.FontUnderline = Check3.Value Label1.FontUnderline = Check3.Value Label2.FontUnderline = Check3.Value End Sub
Private Sub Check4_Click() Label3.FontStrikethru = Check4.Value Label1.FontStrikethru = Check4.Value Label2.FontStrikethru = Check4.Value End Sub Kode ida mak keluar ninian artinya atu hamate form nebe aktif hela Private Sub Command1_Click() Unload Me End Sub Kode nee mak ho nia fungsaun hodi halo ativasaun ba iha option5 nia laran Private Sub Form_Activate() Option5.SetFocus End Sub Kode tuir mai nee ita atu ninia color bai iha label ihrak nebee ita desenho ona iha leten nee; Private Sub Option1_Click() Label3.ForeColor = vbRed Label1.ForeColor = vbRed Label2.ForeColor = vbRed End Sub July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Command3_Click() {listing hapus data nian} Text4.Text = "" Text5.Text = "" Text6.Text = "" Text7.Text = "" Text8.Text = "" End Sub
Private Sub Command4_Click() {listing keluar ninian} BILU = MsgBox("HAKARAK SAI HUSI FORM NE'E...?", vbQuestion + vbYesNo, "MENSSAGEN HUSI BILU") If BILU = vbYes Then Unload Me End If End Sub Klik dalarua iha form mamuk nia laran iha procedure ita hili load nia fungsi atu loding ka halo prosesamentu ba dadus nebe mak ita hatama ba laran; Private Sub Form_Load() Combo1.AddItem "KATOLIK" Combo1.AddItem "PROTESTANTE" Combo1.AddItem "ISLAM" Combo1.AddItem "BUNDAH" End Sub
Private Sub Command3_Click() Label8.Caption = Text1.Text Label9.Caption = Text2.Text Label10.Caption = Text3.Text Label11.Caption = Text4.Text End Sub
Private Sub Command4_Click() Label8.Caption = "" Label9.Caption = "" Label10.Caption = "" Label11.Caption = "" End Sub
Private Sub Form_Activate() Label6.Caption = "INFORMASI HITUNGAN DARI MANE-MESAK" Label7.Caption = "Copy@right dari X-Only-One" Label12.Caption = "Input-Data" Label13.Caption = "Output-Data" End Sub
Private Sub Label6_Click() Label6.Caption = "DATE" End Sub
Private Sub Text2_Change() Text4.Text = Val(Text2.Text) * Val(Text3.Text) End Sub
Private Sub Text3_Change() July 19, 2014 PRATIKA VISUAL BASIC 6.0
Text4.Text = Val(Text2.Text) * Val(Text3.Text) End Sub Search jalur nebee mak iha kota laran, hatam kode iha kode jalur ninian nia reselutadu sei mosu omatikamente iha jalur ninian Form desenhu
Resultado
Kode program Private Sub Command1_Click() {kode remata ka selesai nian} End End Sub Klik dua kali iha form mamuk nia laran ita hili procedure load; Private Sub Form_Load() Text1 = "" End Sub
Private Sub Text1_Change() If Val(Text1.Text) >= 4 Then Text2.Text = "Jalur ne'e salah" ElseIf Val(Text1.Text) = 1 Then Text2.Text = "Comoro Bidau" ElseIf Val(Text1.Text) = 2 Then Text2.Text = "Becora Mercado lama" ElseIf Val(Text1.Text) = 3 Then Text2.Text = "Bidau Has Laran" End If End Sub
Listing programa July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Combo1_Click() If Combo1.Text = "merah" Then Me.BackColor = vbRed ElseIf Combo1.Text = "kuning" Then Me.BackColor = vbYellow ElseIf Combo1.Text = "hijau" Then Me.BackColor = vbGreen ElseIf Combo1.Text = "biru" Then Me.BackColor = vbBlue Else Me.BackColor = vbWhite End If End Sub
Private Sub Command1_Click() Unload Me End Sub
Private Sub Form_Load() Combo1.AddItem "merah" Combo1.AddItem "kuning" Combo1.AddItem "hijau" Combo1.AddItem "biru" Combo1.AddItem "putih" End Sub
Private Sub Text4_Change() Dim total, bayar, DISKON As Single total = Val(Text3.Text) * Val(Text4.Text) If total >= 100000 Then DISKON = 0.3 * total ElseIf total >= 75000 Then DISKON = 0.2 * total ElseIf total < 500000 Then DISKON = 0 End If bayar = DISKON - total Text5.Text = Format(total, "###,###,###") Text6.Text = Format(DISKON, "###,###,###") Text7.Text = Format(bayar, "###,###,###") End Sub
LISTING PROGRAM Private Sub Command1_Click() MsgBox "Maluk Sira Imi Diak Ka Lae..? Agora Situasaun Iha Dilli LaranNe'e Manas Lo'os....Kontak No Tlp : +670 76180050" End Sub Private Sub Command2_Click() MsgBox "Main menu terdiri dari dua komponen utama yaitu menu bar dan title bar. Menu bar" & "menampilkan menu yang berisi perintah-perintah pada Visual Basic 6.0, sedangkan title bar akan" & "menampilkan judul proyek Visual Basic yang sedang dikerjakan" End Sub July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Command3_Click() only = MsgBox("Do you like sign out form here...???", vbQuestion + vbRetryCancel, "only") If only = vbRetry Then Unload Me End If End Sub
LATIHAN 9
LISTING PROGRAM Private Sub Combo1_Change() If Combo1.Text = "Perumahan" Then Text3.Text = 1000 ElseIf Combo1.Text = "Perkantoran" Then Text3.Text = 1500 ElseIf Combo1.Text = "Bisnis" Then Text3.Text = 2000 End If End Sub
Private Sub Text4_Change() Dim total, ppn, bayar As Single total = Val(Text4.Text) * Val(Text3.Text) ppn = total * 0.1 bayar = total + ppn Text5.Text = Format(total, "###,###,###") Text6.Text = Format(ppn, "###,###,###") Text7.Text = Format(bayar, "###,###,###") End Sub
LATIHAN 10
LISTING PROGRAM Private Sub Check1_Click() Label2.FontBold = Check1.Value End Sub
Private Sub Check2_Click() Label2.FontItalic = Check2.Value End Sub rivate Sub Check3_Click() Label2.FontUnderline = Check3.Value July 19, 2014 PRATIKA VISUAL BASIC 6.0
End Sub Private Sub Check4_Click() Label2.Font = vbresetcolor End Sub
Private Sub Check5_Click() Label2.AutoSize = True End Sub
Private Sub Command1_Click() Label2.Caption = Text1.Text End Sub
Private Sub Command2_Click() Unload Me End Sub
Private Sub Option1_Click() Label2.ForeColor = vbRed End Sub
Private Sub Option2_Click() Label2.ForeColor = vbBlue End Sub
Private Sub Option3_Click() Label2.ForeColor = vbGreen End Sub Private Sub Option4_Click() Label2.ForeColor = vbYellow End Sub July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Command2_Click() Text3.Text = Val(Text1) - Val(Text2) End Sub
Private Sub Command3_Click() Text3.Text = Val(Text1) * Val(Text2) End Sub
Private Sub Command4_Click() Text3.Text = Val(Text1) / Val(Text2) End Sub
Private Sub Command5_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text1.SetFocus End Sub
Private Sub Command6_Click() MSG = MsgBox("Ita hakarak sai husi form ida ne'e ?", vbQuestion + vbYesNo, "Mensajen") If MSG = vbYes Then Unload Me End If End Sub
Private Sub Form_Activate() Text1.Text = "" Text2.Text = "" Text3.Text = "" July 19, 2014 PRATIKA VISUAL BASIC 6.0
LISTING PROGRAM Private Sub Command1_Click() If Check1.Value = 1 Then hg_buku = 6000 If Check2.Value = 1 Then hg_pena = 4500 If Check3.Value = 1 Then hg_pencil = 1200 If Check4.Value = 1 Then hg_penghapus = 500 Total = hg_buku + hg_pena + hg_pencil + hg_penghapus Text1.Text = " Rp " & Total End Sub
Private Sub Command2_Click() July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Option4_Click() If Option4.Value = True Then Shape1.Shape = 3 End Sub Private Sub Option5_Click() If Option5.Value = True Then Shape1.Shape = 4 End Sub
Private Sub Option6_Click() If Option6.Value = True Then Shape1.Shape = 5 End Sub
LATIHAN
LISTING PROGRAM
Private Sub cmd_Click() End End Sub
Private Sub Form_Activate() Text1.Text = "" End Sub July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Text1_Change() List1.Clear jumlah = 1 While jumlah <= Val(Text1.Text) List1.AddItem "pengulangan ke" & jumlah jumlah = jumlah + 1 Wend End Sub
LATIHAN
LISTING PROGRAM Private Sub Command1_Click() Text3 = 2014 - Text2 Text3 = Text3 End Sub
List1.AddItem "A'at lo'os...!!!" End If MsgBox "Ita bo'ot nia valor Mata kuliah ida ne'e mak :" + Mutu End Sub
Kode Mulai Nian Private Sub cmd2_Click() Text1.Text = Empty Text2.Text = Empty Option1.Value = False Option2.Value = False Combo1.Text = "" Text3.Text = Empty Combo2.Text = "" Text8.Text = Empty Text4.Text = Empty Text5.Text = Empty Text6.Text = Empty Text7.Text = Empty List1.Clear Text1.SetFocus End Sub Kode Sai Nian Private Sub cmd3_Click() X = MsgBox("Hakarak Sai Husi Form Ne'e..?", vbQuestion + vbYesNo, "Info Husi Biliu") If X = vbYes Then Unload Me End If End Sub July 19, 2014 PRATIKA VISUAL BASIC 6.0
Private Sub Option2_Click() Label14.Caption = Option2.Caption End Sub
Private Sub Option3_Click() Label15.Caption = Option3.Caption If Option3.Value = True And Option1.Value = True Then Label16.Caption = "$10.00" ElseIf Option3.Value = True And Option2.Value = True Then Label16.Caption = "$20.00" End If End Sub
Private Sub Option4_Click() Label15.Caption = Option4.Caption If Option4.Value = True And Option1.Value = True Then Label16.Caption = "$15.00" ElseIf Option4.Value = True And Option2.Value = True Then Label16.Caption = "$25.00" End If End Sub
Private Sub Option5_Click() Label15.Caption = Option5.Caption If Option5.Value = True And Option1.Value = True Then Label16.Caption = "$25.00" ElseIf Option5.Value = True And Option2.Value = True Then Label16.Caption = "$35.00" End If End Sub
Modul III KONEKSAUN DATABASSE MAHASISWA PADA PEMOGRAMA VISUAL BASICO 6.0 Databasse nebee ita kria nee hodi atu fo koneksaun ba microsoft visual basic 6.0;
Private Sub Command6_Click() BILU = MsgBox("ITA HAKARAK SAI HUSI FORM NE'E...", vbQuestion + vbYesNo, "INFORMASAUN HUSI MANE-MESAK") If BILU = vbYes Then Unload Me End If End Sub
Private Sub Command7_Click() AB = Text3.Text TU = Text4.Text UT = Text5.Text UA = Text6.Text
RSLT = (AB * 0.02) + (TU * 0.2) + (UT * 0.25) + (UA * 0.45)
Modul IV HALO REPORT Report ho laporan mak dokumentu ka data nebe mak hatama iha tabela, atu detaile liu ba ita atu hare momos no ita atu print.
Maneira Atu Halo Reportagen Databasse nia prossesu mak hanesan tuir mai nee : 1. Klick Iha Menu Project, no hili Add Data Enviromment ho nia img mak hanesan tuir mai nee :
Klik liman los iha command mak nia imagen hanesan tuir mai nee
Hili properties mak nia imagen hanesan tuir mai nee July 19, 2014 PRATIKA VISUAL BASIC 6.0