Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


[vb] Simple Quick Codes

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic



    I'm very inactive :(

  • Patrons
  • 2,560 posts
  • Joined 13-October 02
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

How to remove advertisement from MSFN



    I'm very inactive :(

  • Patrons
  • 2,560 posts
  • Joined 13-October 02
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 :)

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
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