MSFN Forum: [vb] Simple Quick Codes - MSFN Forum

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[vb] Simple Quick Codes Rate Topic: -----

#1 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 11 April 2003 - 07:34 AM

Display the Current Time
Simply put a label control
in form load event put
Private Sub Form_Load()
labelname.caption = time
End Sub

and if u want it to be updated every second add timer and label
Private Sub Timer1_Timer()
labelname.caption = time
End Sub

make sure u make the timer interval = 1


#2 User is offline   Doggie 

  • I'm very inactive :(
  • Group: Patrons
  • Posts: 2,676
  • Joined: 13-October 02

Posted 17 May 2003 - 06:06 AM

File System

Like to know how to do such things as delete file(s) and directory(s)? Even create directories etc?
Well, take a look what i'm about to write :)

Directory(s)
To create a directory, simply use this code;
VBA.FileSystem.MkDir "driveletter:\directoryname"

eg VBA.FileSystem.MkDir "C:\dogs"
simple huh? :rolleyes:

Maybe u'd like to remove a specifyed directory?
VBA.FileSystem.RmDir "driveletter:\directoryname"

same type of method with the drive letter and dir name
just a note about this. To avoid errors with this, add the follow to the code;
On Error GoTo errLog
VBA.FileSystem.RmDir "c:\rabbits" ' This is an example say if it didn't exist so no need to add this :P
errLog:
If Err.Number = 76 Then
MsgBox "Directory doesn't exist"
End If

Time to use the On Error Goto statement. The example states on an error goto ErrLog
What this means if the error number = 76, simply mean if the directory doesn't exist, a msgbox will appear saying so.

adding more code soon, please be patient :D

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy