Powered by Blogger.
Showing posts with label Latihan vb 6. Show all posts
Showing posts with label Latihan vb 6. Show all posts
Saturday, 7 July 2012

PROGRAM TIMER EVENT EXAMPLE - CONTOH


Timer Event Example |

This example demonstrates a digital clock. To try this example, paste the code into the Declarations section of a form that contains a Label control and a Timer control, and then press F5.

Private Sub Form_Load ()
   Timer1.Interval = 1000   ' Set Timer interval.
End Sub

Private Sub Timer1_Timer ()
   Label1.Caption = Time   ' Update time display.
End Sub

This example moves a PictureBox control across a form. To try this example, paste the code into the Declarations section of a form that contains a Timer control and a PictureBox control, and then press F5. For a better visual effect you can assign a bitmap to the PictureBox using the Picture property.

Dim DeltaX, DeltaY As Integer   ' Declare variables.
Private Sub Timer1_Timer ()
   Picture1.Move Picture1.Left + DeltaX, Picture1.Top + DeltaY
   If Picture1.Left < ScaleLeft Then DeltaX = 100
   If Picture1.Left + Picture1.Width > ScaleWidth + ScaleLeft Then
      DeltaX = -100
   End If
   If Picture1.Top < ScaleTop Then DeltaY = 100
   If Picture1.Top + Picture1.Height > ScaleHeight + ScaleTop Then
      DeltaY = -100
   End If
End Sub

Private Sub Form_Load ()
   Timer1.Interval = 1000   ' Set Interval.
   DeltaX = 100   ' Initialize variables.
   DeltaY = 100
End Sub





Okay ulasan yang lain sedang menunggu coba anda lihat  program perintah sql serta auto search  dan 
program mengembalikan variable
Program Mencari Karakter

Unknown Latihan vb 6

CONTOH PROGRAM MENCARI KARAKTER


Program Mencari Karakter |

InStr Function Example
This example uses the InStr function to return the position of the first occurrence of one string within another.
Dim SearchString, SearchChar, MyPos
SearchString ="XXpXXpXXPXXP"   ' String to search in.
SearchChar = "P"   ' Search for "P".

' A textual comparison starting at position 4. Returns 6.
MyPos = Instr(4, SearchString, SearchChar, 1)   

' A binary comparison starting at position 1. Returns 9.
MyPos = Instr(1, SearchString, SearchChar, 0)

' Comparison is binary by default (last argument is omitted).
MyPos = Instr(SearchString, SearchChar)   ' Returns 9.

MyPos = Instr(1, SearchString, "W")   ' Returns 0.




Okay ulasan yang lain sedang menunggu coba anda lihat  program perintah sql serta auto search  dan 
program mengembalikan variable
Program Timer Event Example
Unknown Latihan vb 6

KONEKSI CRYSTAL REPORT DAN CONTROL DATA

Untuk mengkoneksikan dengan Crystal report dan mengontrol data dari program VB |


Pada Reference dipilih Microsoft Active Data Object Recordset.

Dim Report As New CrystalReport1
Dim Ado As New ADOR.Recordset

Private Sub CmdCetak_Click()
If Ado.State = adStateOpen Then
    Ado.Close
End If
    Ado.Open "select * from sampel where No_sampel='" + TxtNoSampel.Text + "'", "sampel database"
    Report.Database.SetDataSource Ado
    Form5.CRViewer1.ReportSource = Report
    Form5.CRViewer1.ViewReport
    Form5.Show
    Set Report = Nothing
End Sub


Unknown Latihan vb 6

PROGRAM PERINTAH SQL BACA VARIABLE AND AUTO SEARCH




Untuk membuat perintah SQL dapat membaca variable :

Misall nama variabelnya “Panjang”
Print "select * from inspeksi where right" + "(No_Sampel," + Panjang + ")" + "='" + Trim(Jenis + "/" & Bln & "/" & Thn) & "'"



Auto search program:

Private Sub TxtEditSampel_Change()
xx = Len(Trim(TxtEditSampel.Text))
If xx = 0 Then
    xx = 1
    AdoInspeksi.RecordSource = "select * from inspeksi"
    AdoInspeksi.Refresh
Else
    bb = Mid$(TxtEditSampel.Text, 1, xx)
    AdoInspeksi.RecordSource = "select * from inspeksi where mid$(trim(no_sampel),1," & xx & ")='" + Trim(bb) + "'"
    AdoInspeksi.Refresh
End If
End Sub



Unknown Latihan vb 6

PROGRAM UNTUK MENGEMBALIKAN FUNGSI VARIABLE




Dim v As TextBox
Private Sub Command1_Click()
v.Locked = True
End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)
Set v = Text1
v.Locked = True
Form1.Caption = v.Locked
End Sub


Unknown Latihan vb 6
Wednesday, 4 July 2012

MENGETAHUI TENTANG LISTBOX PADA VB6


ListBox
Adalah Control yang digunakan untuk menampilkan pilihan yang jumlahnya relatif banyak

Properties ListBox
Columns => Menentukan Jumlah Kolom
List => Digunakan untuk mengisi data saat design
MultiSelect => Memungkinkan pemakai memilih lebih dari satu pilihan
Sorted => Mengurutkan Pilihan
Style
Standard
Checkbox
Listcount => Mengetahui jumlah pilihan
Listindex => Mengetahui nomo urut pilihan yang sedang dipilih
List(index) => Mengetahui nilai pilihan yang ke index
Selected(index) => Mengetahui apakah pilihan yang ke index sedang dipilih atau tidak

Method Listbox
Clear => Mengosongkan pilihan
Additem => Menambahkan pilihan
Removeitem(index) => Menghapus Pilihan yang ke index


Unknown Latihan vb 6

BENTUK IF DI DALAM IF WITH VB6


Unknown Latihan vb 6

CONTOH BENTUK IF PADA VB 6

IF BENTUK 1


CONTOH BENTUK IF PADA VB 6





IF BENTUK 2



Dim gol as string*1
Dim gaji,tun,bonus as double
Gol=“A”
If gol=“A” then
   gaji=100
   tun=50
   bonus=25
Elseif gol=“B” then
   gaji=200
   tun=100
   bonus=50
Else
   gaji=200
   tun=100
   bonus=50
Endif
Print  Gaji,tun,bonus
Unknown Latihan vb 6