< PreviousMicrosoft Visual Basic 6.0195Next iIf c < 0 ThenText3.Text = 1 / aElseText3.Text = aEnd IfEnd Sub11.Menggunakan Fungsi Perulangan untuk Memanfaatkan Sub RuntimePerforman/PortofolioI.Buatlah program sederhana berikut!a.Program sederhana 1. Mengganti warna label, miringkan dan sembunyikan text label1.Bukalah sebuah form baru dengan komponen-komponennya seperti gambar berikut!Program label dan Command Button saat runtime2.Aturlah property setiap kontrol sebagai berikut!Form/KontrolSettingPropertiFormNameCaptionForm1HALLO SISWA SMA/MA KELAS XILabel1CaptionNameAlignmentFontFore ColorVisibleSELAMAT BELAJAR MICROSOFT VISUALBASICLabel12-CenterMS Sans Serif 12Hitam &H80000012&TrueTeknologi Informasi dan Komunikasi Kelas X1963.Buka kotak jendela Project Form (Code) dan tulislah kode-kode seperti berikut!Private Sub Command3_Click()'Miringkan text label1Label1.FontItalic = TrueEnd SubPrivate Sub Command4_Click()'Tegakkan text label1Label1.FontItalic = FalseEnd SubPrivate Sub Command5_Click()'Sembunyikan text label1Label1.Visible = FalseEnd SubPrivate Sub Command6_Click()Form/KontrolSettingPropertiCommand1NameCaptionFontCommand1HitamkanMS Sans Serif 10Command2NameCaptionFontCommand2MerahkanMS Sans Serif 10Command3NameCaptionFontCommand3MiringkanMS Sans Serif 10Command4NameCaptionFontCommand4TegakkanMS Sans Serif 10Command5NameCaptionFontCommand5TegakkanMS Sans Serif 10Command6NameCaptionFontCommand6TegakkanMS Sans Serif 10Microsoft Visual Basic 6.0197'Tampilkan text label1Label1.Visible = TrueEnd Sub4.Periksalah dengan teliti kode yang kamu tulis. Jika sudah benar coba jalankan dengan menekantombol F5 pada keyboard atau klik ikon Start.5.Simpanlah melalui File-Save Form As dengan menentukan nama form (Belajar VB 1) sertalokasi penyimpanan pada kotak dialog Save File As.b.Program sederhana 2. Kalender hari ini1.Bukalah sebuah form baru dengan komponen-komponennya seperti gambar berikut!Ikon StartForm Kalender2.Aturlah property setiap kontrol sebagai berikut!Form/KontrolSettingPropertiFormNameCaption\HeightWidthForm1Kalender49255685Teknologi Informasi dan Komunikasi Kelas X198Form/KontrolSettingPropertiFrame1NameCaptionFontFore ColorHeightWidthFrame1Tanggal Hari IniTimes New Roman Bold 12Biru &H00FF0000&192,75162,75Frame2NameCaptionFontFore ColorHeightWidthFrame2Jam Hari IniTimes New Roman Bold 12Biru &H00FF0000&144,7590,75Label1NameAlignmentAuto SizeCaptionFontForeColorHeightWidthLabel12-CenterTrueSelasaTimes New Roman Bold 12Biru &H00FF0000&4651125Label2Label3NameAlignmentAuto SizeCaptionFontForeColorHeightWidthLabel22-CenterFalse25Times New Roman Bold 72Biru &H00FF0000&16351845NameAlignmentAuto SizeCaptionFontForeColorHeightWidthLabel32-CenterTrueOktober 2005Times New Roman Bold 12Biru &H00FF0000&4651125Label4NameAlignmentAuto SizeCaptionLabel42-CenterTrue00:00:00Microsoft Visual Basic 6.01993.Buka kotak jendela Project Form (Code) dan tulislah kode-kode seperti berikut!Private Sub Command1_Click()'KeluarEndEnd SubPrivate Sub Timer1_Timer()'Label1 adalah format nama hariLabel1.Caption = Format(Now, "dddd")'Label2 adalah format TanggalLabel2.Caption = Format(Now, "d")'Label3 adalah format nama bulan dan tahunLabel3.Caption = Format(Now, "mmmm") & " " & Format(Now, "yyyy")'Label4 adalah format Jam, menit dan detikLabel4.Caption = Format(Now, "hh:mm:ss")'Jika label1="Minggu" maka semua label berwarna merahIf Label1.Caption = "Minggu" ThenLabel1.ForeColor = &HC0&Label2.ForeColor = &HC0&Label3.ForeColor = &HC0&Label4.ForeColor = &HC0&End IfEnd Sub4.Periksalah dengan teliti kode yang kamu tulis. Jika sudah benar coba jalankan dengan menekantombol F5 pada keyboard atau klik ikon Start!Form/KontrolSettingPropertiFontForeColorHeightWidthTimes New Roman Bold 20Biru &H00FF0000&4651125Command1NameCaptionFontStyleCommand1SelesaiTimes New Roman Bold 141-GraphicalTimer1NameIntervalTimer11000Teknologi Informasi dan Komunikasi Kelas X2005.Simpanlah melalui File-Save Form As dengan menentukan nama form (Belajar VB 2) sertalokasi penyimpanan pada kotak dialog Save File As!c.Program sederhana 3. Manipulasi warna, ukuran dan bentuk1.Bukalah sebuah form baru dengan komponen-komponennya seperti gambar berikut!Form manipulasi warna, ukuran dan bentuk2.Aturlah property setiap kontrol sebagai berikut!Form/KontrolSettingPropertiNameCaptionHeightWidthForm1Manipulasi warna, ukuran dan bentuk48156375FormCombo1NameHeightTextWidthCombo14815Bentuk Bangun Datar6375Shapes1NameFillStyleHeightWidthCombo1Solid18152895NameCaptionFontFore ColorHeightWidthFrame1Model HurufMS San Serief 8Button Face &H80000012&16591455Frame1Microsoft Visual Basic 6.0201Form/KontrolSettingPropertiFrame2NameCaptionFontFore ColorHeightWidthFrame2WarnaMS San Serief 8Button Face &H80000012&16591455Label1NameAlignmentAuto SizeCaptionFontForeColorHeightVisibleWidthLabel12-CenterTrueGambar 1MS San Serief 8Button Face &H80000012&255False2895Label2NameAlignmentAuto SizeCaptionFontForeColorHeightVisibleWidthLabel22-CenterFalseGambar 2MS San Serief 8Button Face &H80000012&255False2895Label3NameAlignmentAuto SizeCaptionFontForeColorHeightVisibleWidthLabel32-CenterFalseTerdapat padaMS San Serief 8Button Face &H80000012&255False2895Check1NameCaptionHeightWidthCheck1Tebalkan3751095Teknologi Informasi dan Komunikasi Kelas X2023.Buka kotak jendela Project Form (Code) dan tulislah kode-kode seperti berikut!Private Sub Form_Load()Option1.Value = FalseOption2.Value = FalseOption3.Value = FalseCombo1.AddItem "Persegi Panjang"Combo1.AddItem "Persegi"Combo1.AddItem "Oval"Combo1.AddItem "Lingkaran"Form/KontrolSettingPropertiNameCaptionHeightWidthCheck2Check2Miringkan3751095Check3NameCaptionHeightWidthCheck3Garis bawah3751095Option1NameCaptionHeightWidthOption1Merah255975Option2NameCaptionHeightWidthOption2Kuning255975Option3NameCaptionHeightWidthOption3Hijau255975Option4NameCaptionHeightWidthOption4Biru255975Picture1NameHeightWidthPicture114552895Microsoft Visual Basic 6.0203End SubPrivate Sub Combo1_Click()Select Case Combo1.ListIndexCase 0Label1.Visible = TrueLabel2.Visible = TrueShape1.Shape = 0Label1.Caption = "Contoh bangun persegi panjang adalah papan tulis danpiagam"Picture1.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Bd04914_.wmf")Picture2.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Bs00580_.WMF")Label1.Caption = "Amplop"Label2.Caption = "Layar monitor"Case 1Label1.Visible = TrueLabel2.Visible = TrueShape1.Shape = 1Picture1.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Hh01669_.WMF")Picture2.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Bd04897_.WMF")Label1.Caption = "Bangku"Label2.Caption = "Sisi dadu"Case 2Label1.Visible = TrueLabel2.Visible = TrueShape1.Shape = 2Picture1.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Pe01659_.WMF")Picture2.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Pe02719_.WMF")Label1.Caption = "Bentuk bola raghby"Label2.Caption = "Bentuk cermin"Case 3Label1.Visible = TrueLabel2.Visible = TrueShape1.Shape = 3Picture1.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Bd07304_.wmf")Picture2.Picture = LoadPicture("C:\Program Files\Common Files\MicrosoftShared\Clipart\cagcat50\Bd07175_.WMF")Label1.Caption = "Lampu lalu lintas"Teknologi Informasi dan Komunikasi Kelas X204Label2.Caption = "Setir Mobil"End SelectEnd SubPrivate Sub Check1_Click()If Check1.Value = 1 ThenLabel1.FontBold = TrueLabel2.FontBold = TrueElseLabel1.FontBold = FalseLabel2.FontBold = FalseEnd IfEnd SubPrivate Sub Check2_Click()If Check2.Value = 1 ThenLabel1.FontItalic = TrueLabel2.FontItalic = TrueElseLabel1.FontItalic = FalseLabel2.FontItalic = FalseEnd IfEnd SubPrivate Sub Check3_Click()If Check3.Value = 1 ThenLabel1.FontUnderline = TrueLabel2.FontUnderline = TrueElseLabel1.FontUnderline = FalseLabel2.FontUnderline = FalseEnd IfEnd SubPrivate Sub Option1_Click()Option1.Value = TrueLabel1.ForeColor = &HC0&Label2.ForeColor = &HC0&Shape1.FillColor = &HC0&End SubPrivate Sub Option2_Click()Option2.Value = TrueLabel1.ForeColor = &HFFFF&Label2.ForeColor = &HFFFF&Shape1.FillColor = &HFFFF&Next >