This is my version of tailf
import sys, time, os
filename = 'path to file'
try:
with open(filename) as f:
size = os.path.getsize(filename)
if size < 1024:
s = size
else:
s = 999
f.seek(-s, 2)
l = f.read()
print l
while True:
line = f.readline()
if not line:
time.sleep(1)
continue
print line
except IOError:
pass
Чтобы ответить на ваш вопрос, нам может потребоваться дополнительная информация. - Вы получаете сообщение об ошибке? - Где находится label1 и listbox6? - Что вызывает код? Какое событие вы пытаетесь использовать?
Dim intIndex As Integer
Dim intCount As Integer
intcount = 0
With **Form1.**ListBox6
For intIndex = 0 To .ListCount - 1
If .Selected(intIndex) Then
intCount = intCount + 1
End if
Next
**Me.**Label1.Caption = "Deelnemers: " & intCount & " op " & .ListCount
End With
Вы также можете попробовать для каждого цикла;
Dim Li as listitem
dim seleciontcount as integer
selectioncount = 0
For each li in listbox6.items
if li.selected then
selectioncount = selectioncount + 1
end if
next