Tuesday, May 8, 2012

Ini buat teman-teman blogger yang sedang belajar VB 6 aku punya tipnya.. tips ini aku dapatkan dari forum VB BEGO atau I-BEGO.

1.Denied deletion file, this trick are open the file for simultan s
o the windows couldn’t delete the file until the aplication end or stopped
private sub form_load()
timer1.interval = 1
end sub
Private sub timer1_timer()
Open PathFilenya For Input As 1
end sub

2.Random Coloured label, this trick will change your label each sec
Private Sub Timer1_Timer()
Label1.ForeColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub

3.Set the Attributes file without API function
Private Sub Command1_Click()
Setattr pathname,vbhidden+vbsystem+vbreadonly
End Sub
‘To make it normal
Private Sub Command1_Click()
Setattr pathname,vbnormal
End Sub

4. Animated form when unload
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
‘The form go up
Do Until Me.Top <= -5000
Me.Move Me.Left, Me.Top – 10
Unload Me
End Sub

5.Gradiation Back Color Form
Private Sub Form_Load()
Form1.AutoRedraw = True
For x = 0 To ScaleHeight
Line (1, x)-(ScaleWidth, x), RGB(5, 10, 255 – (x * 255) \ ScaleHeight)
Next x
End Sub

6. Select all content in textbox the easiest way and always used by POS or accounting application just insert these code to event proc
SendKeys “{home}+{end}”
7. UnClosed Form
Private Sub Form_Unload (Cancel as Integer)
Cancel = 1
End Sub

8. ASCII Detector
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Me.Caption = KeyCode
End Sub

9. Check the existence of Folder or Files
‘Check the Folder
If Dir$(Text1.Text, vbDirectory) = “” Then
msgbox “Folder Not Exist”, vbinformation
ElseIf Dir$(Text1.Text, vbDirectory) <> “” Then
msgbox “Folder Exist”, vbinformation
End If
‘Check The File
If Dir(Text1.Text) = “” Then
msgbox “File Not Exist”, vbinformation
ElseIf Dir(Text1.Text) <> “” Then
msgbox “File Exist”, vbinformation
End If

10. Dragging the Form from around of your form
Private move_x As Integer
Private move_y As Integer
Private move_form As Boolean
Private Sub form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
move_x = X
move_y = Y
move_form = True
End Sub
Private Sub form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If move_form Then
Me.Move Me.Left + X – move_x, Me.Top + Y – move_y
End If
End Sub
Private Sub form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
move_form = False
End Sub

yaaa. kira2 segitu dulu, malu bertanya sesat dijalan..


Post a Comment

Isi Komentar anda dengan sopan jika ingin di terbitkan...