Code di bawah ini digunakan untuk menyeragamkan properties object tertentu dalam sebuah form.
Tambahkan sebuah Module ke dalam Project Anda, kemudian copy-Paste code dibawah ini :
Sub setCursor(frm As Form)Kemudian tambahkan sebuah Form dan beberapa object dibawah ini
On Error Resume Next
Dim obj As Control
For Each obj In frm.Controls
If TypeOf obj Is CommandButton Then
obj.MousePointer = 99
Set obj.MouseIcon = LoadPicture(App.Path & "\HAND-M.CUR")
End If
Next
End Sub
Sub setColor(frm As Form, color As ColorConstants)
On Error Resume Next
Dim obj As Control
For Each obj In frm.Controls
If TypeOf obj Is TextBox Then
obj.BackColor = color
End If
Next
End Sub
Sub setValue(frm As Form, teks As String)
On Error Resume Next
Dim obj As Control
For Each obj In frm.Controls
If TypeOf obj Is TextBox Then
obj.Text = teks
End If
Next
End Sub
Sub setLabel(frm As Form)
On Error Resume Next
Dim obj As Control
For Each obj In frm.Controls
If TypeOf obj Is Label Then
obj.AutoSize = True
obj.BackStyle = 0
End If
Next
End Sub
1. Label (Jumlah bebas)
2. ComboBox (1 buah)
3. TextBox (Jumlah bebas)
4. CommandButton (Jumlah bebas)
Selanjutnya COPAS kode dibawah ini kedalam jendela coding form tersebut :
Private Sub Combo1_Click()
Select Case Combo1.ListIndex
Case 0
setColor Me, vbRed
Case 1
setColor Me, vbWhite
Case 2
setColor Me, vbGreen
End Select
End Sub
Private Sub Command1_Click()
setValue Me, ""
End Sub
Private Sub Form_Load()
Combo1.AddItem "Merah"
Combo1.AddItem "putih"
Combo1.AddItem "hijau"
setCursor Me
setColor Me, vbWhite
setValue Me, ""
setLabel Me
End Sub
Source Code :
http://www.ziddu.com/download/11983326/globalproperties.rar.html
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :