1 / 27

Struktur Data II dengan Visual Basic

Struktur Data II dengan Visual Basic. ptputraastawa@gmail.com Ptputraastawa.wordpress.com @2011. Bekerja Dengan Form. Data dan Variabel. Penggunaan Data dan Variabel. Informasi yang disimpan atau diolah oleh komputer disebut DATA. Type Data VB.

zavad
Download Presentation

Struktur Data II dengan Visual Basic

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

E N D

Presentation Transcript


  1. Struktur Data II dengan Visual Basic ptputraastawa@gmail.com Ptputraastawa.wordpress.com @2011 BekerjaDengan Form

  2. Data danVariabel

  3. Penggunaan Data danVariabel • Informasi yang disimpanataudiolaholehkomputerdisebut DATA.

  4. Type Data VB • Stringadalah type data untukteks (huruf, angkadantandabaca). • Integeradalah type data untukangkabulat. • Single adalah type data untukangkapecahan • Currency adalah type data untukangkamatauang. • Dateadalah type data untuktanggaldan jam. • Booleanadalah type data yang bernilai TRUE atau FALSE.

  5. Variable • Data yang disimpandidalam memory komputermembutuhkansebuahwadah. • Wadahinilah yang disebutdenganVARIABEL. • Setiapvariabeluntukmenyimpan data dengan type tertentu • Membutuhkanalokasijumlah memory (byte) yang berbeda.

  6. Penulisandeklarasivariabel Dim <nama_variabel> As <type_data> • Contoh : Dim nama_user As String

  7. AturanPenamaanVariabel : • Harusdiawalidenganhuruf. • Tidakbolehmenggunakanspasi. Spasibisadigantidengankarakter underscore (_). • Tidakbolehmenggunakankarakter-karakterkhusus (seperti : +, -, *, /, <, >, dll). • Tidakbolehmenggunakankata-katakunci yang sudahdikenaloleh Visual Basic 6 (seperti : dim, as, string, integer, dll).

  8. Contoh: program variable • GunakankomponenCommandButtondan Label

  9. Pengaturan property setiap object

  10. Dim test2 As Integer Private Sub Command1_Click() Dim test1 As String test1 = "nusantara" Label1.Caption = test1 Label2.Caption = test2 Label3.Caption = test3 End Sub Private Sub Command2_Click() test2 = 10 Label1.Caption = test1 Label2.Caption = test2 Label3.Caption = test3 End Sub • Code Editor ketikkankode program Private Sub Command3_Click() Const test3 As Single = 90.55 Label1.Caption = test1 Label2.Caption = test2 Label3.Caption = test3 End

  11. Operator

  12. Pengertian Operator • Operator merupakansimbol yang digunakanuntukmelakukan suatu operasi terhadap nilai data

  13. Tigajenis operator • Operator Aritmatika • Operator Perbandingan • Operator Logika

  14. Operator Aritmatika

  15. Operator Perbandingan

  16. Operator Logika

  17. Contoh Program : Operator • UI Operator

  18. UI Operator

  19. Pengaturan property setiap object

  20. Code Editor kode program(1) Dim var1 As Single, var2 As Single,hasilAs Single Private Sub Option1_Click() • var1 = Text1.Text • var2 = Text2.Text • hasil = var1 + var2 • Label3.Caption = hasil End Sub Private Sub Option2_Click() • var1 = Text1.Text • var2 = Text2.Text • hasil = var1 -var2 • Label3.Caption = hasil • End Sub

  21. Code Editor kode program(2) Private Sub Option3_Click() var1 = Text1.Text var2 = Text2.Text hasil = var1 * var2 Label3.Caption = hasil End Sub Private Sub Option4_Click() var1 = Text1.Text var2 = Text2.Text hasil = var1 / var2 Label3.Caption = hasil End Sub

  22. Code Editor kode program(3) Private Sub Option5_Click() var1 = Text1.Text var2 = Text2.Text hasil = var1 & var2 Label3.Caption = hasil End Sub Private Sub Option6_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 > var2) Label3.Caption = hasil Label3.Caption = Format(hasil, "True/False") End Sub

  23. Code Editor kode program(4) Private Sub Option7_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 < var2) Label3.Caption = Format(hasil, "True/False") End Sub Private Sub Option8_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 = var2) Label3.Caption = Format(hasil, "True/False") End Sub

  24. Code Editor kode program(5) Private Sub Option9_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 <> var2) Label3.Caption = Format(hasil, "True/False") End Sub Private Sub Option10_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 >= var2) Label3.Caption = Format(hasil, "True/False") End Sub

  25. Code Editor kode program(6) Private Sub Option11_Click() var1 = Text1.Text var2 = Text2.Text hasil = (var1 <= var2) Label3.Caption = Format(hasil, "True/False") End Sub Private Sub Option12_Click() var1 = IIf(Text1.Text = "True", -1, 0) hasil = Not (var1) Label3.Caption = Format(hasil, "True/False") End Sub

  26. Code Editor kode program(7) Private Sub Option13_Click() var1 = IIf(Text1.Text = "True", -1, 0) var2 = IIf(Text2.Text = "True", -1, 0) hasil = (var1 Or var2) Label3.Caption = Format(hasil, "True/False") End Sub Private Sub Option14_Click() var1 = IIf(Text1.Text = "True", -1, 0) var2 = IIf(Text2.Text = "True", -1, 0) hasil = (var1 And var2) Label3.Caption = Format(hasil, "True/False") End Sub

  27. TerimaKasih

More Related