VB icon

ADVANCED Form Loaded Times

Email
Submitted on: 1/3/2015 12:24:00 PM
By: Demian Net (from psc cd)  
Level: Advanced
User Rating: By 2 Users
Compatibility: VB 5.0, VB 6.0
Views: 528
 
     Gets how many times your form was loaded
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: ADVANCED Form Loaded Times
' Description:Gets how many times your form was loaded
' By: Demian Net (from psc cd)
'
' Returns:Returns as Long
'**************************************

Public Sub SetLoaded()
'put this in your main forms' Load procedure
'this will set the count
Dim lTemp As Long, sPath As String
lTemp& = GetLoaded&
If Right$(App.Path, 1) <> "\" Then sPath$ = App.Path & "\" & App.EXEName & ".tmp" Else sPath$ = App.Path & App.EXEName & ".tmp"
Open sPath$ For Output As #1
Print #1, lTemp& + 1
Close #1
 End Sub
 Public Function GetLoaded() As Long
'call this to get how many times program has been loaded
On Error Resume Next
Dim sPath As String, sTemp As String
If Right$(App.Path, 1) <> "\" Then sPath$ = App.Path & "\" & App.EXEName & ".tmp" Else sPath$ = App.Path & App.EXEName & ".tmp"
Open sPath$ For Input As #1
sTemp$ = Input(LOF(1), #1)
Close #1
If sTemp$ = "" Then GetLoaded& = 0 Else GetLoaded& = CLng(sTemp$)
 End Function


Other 13 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.