Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Count Files


Ryujin
 Share

Recommended Posts

This is my first Tutorial,

I tell you, how to can count the files in the orders and display on your server form.

**Before we beginn, we need following things:**
1x Modul (modCounts)
1x Frame (Directory File Count)
1x Label (Accounts)

**Let's begin:**
You create a Modul and you give it the name **modFileCounts**

And add the follow Code in the Modul:
```
Function CountAccounts() As Long
Dim d As String
Dim i As Long

d = Dir("data\accounts\*.*")

Do Until d = ""
    i = i + 1
    d = Dir
Loop
frmServer.lblCountAccounts.Caption = "Accounts: " & i
End Function
```
Next, you create the Frame and the Lable

**Like this:**
![](http://www.freemmorpgmaker.com/files/imagehost/pics/17037d207c2be1f634fb6f87f5892573.JPG)

Now you give the new Label the name **lblCountAccounts**.

Next you search in the **frmServer** for
```
Private Sub Form_Load()
    Call UsersOnline_Start
End Sub
```
**Below you add this:**
```
Private Sub Form_Activate()
    Call CountAccounts
End Sub
```
**And in the End it look like this:**
![](http://www.freemmorpgmaker.com/files/imagehost/pics/df32a95962111a2f104332fab247827c.JPG)

And what do this?
It counts the files in the Folder of Accounts ;D

When you would to count the maps you must add this in the **modFileCounts**

**Below the CountAccounts Function:**
```
Function CountMaps() As Long
Dim d As String
Dim i As Long

d = Dir("data\maps\*.*")

Do Until d = ""
    i = i + 1
    d = Dir
Loop
frmServer.lblCountMaps.Caption = "Maps: " & i
End Function
```
Now a new Label in the Directory File Count Frame:
![](http://www.freemmorpgmaker.com/files/imagehost/pics/8078f9f6ac7f2a9d6634cd9ae0237487.JPG)

The name of the Lable is **lblCountMaps**

At last you search for **Call CountAccounts** and below you add this **Call CountMaps**

**In the end it look like this:**
![](http://www.freemmorpgmaker.com/files/imagehost/pics/a02df65b21b2a4ffb449c12acd7a4a1d.JPG)

PS: I'm new in VB6
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...