473,385 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Question about NotifyFilters ?

Hello group,
I want to create an array of FileSystemWatchers. The indices of the
arrays will be x(PATH) and NotifyFilters, i.e. for every PATH I will be
able to run one watcher for every NotifyFilters attribute. The first
question that I have is that NotifyFilters range from 1 to 383 with
gaps, which means that alot of objects in the array will by empty,
which will be wasteful. To solve this problem I created a
"companion" enumeration like so
(if it was perl, maybe an associative array could have been helpful)

Enum enum_notify
filename = 0
dirname = 1
attributes = 2
size = 3
write = 4
access = 5
create = 6
sec = 8
End Enum

Would this be a reasonable design?

My second question is regarding the above enumeration,
suppose I want to turn raising events on for all attributes,
I would need to write something like so

For i As enum_notify = enum_notify.filename To enum_notify.sec
If enum_notifyfilter_a And 2 ^ i Then arWatcher(menu.Index,
i).EnableRaisingEvents = True
Next

The only problem here is that the for loop takes the values
0,1,2,3,4,5,6,7,8, i.e. it will include 7 in the loop whereas
enum_notify doesn't use 7, and the 2 ^ i "trick" is
not very elegant. Can I do it in a better way?
Sep 16 '08 #1
2 1002
£$%^" < wrote:
<wanting to iterate over the values of an enum>

http://bytes.com/forum/thread382163.html

Andrew
Sep 17 '08 #2
Hello,

Yes, this has worked, thank you. Can I ask what does the
square bracket do in vb - couldn't find it in msdn?
Sep 17 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
2
by: Iddo | last post by:
Hi I'm using the FileSystemWatcher for notification when a file was Last write. When using the Filter : NotifyFilter.LastWrite I get 2 events. My code looks like this: Private FileSystemWatcher...
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
1
by: Jack David | last post by:
How would I convert the following console app to a windows service?? using System; using System.IO; using FileProcessor;
7
by: Becci | last post by:
Is there a way to know, when we get an "ONChanged" event from the filesystemwatcher, what actually changed, file, last access, last write, etc? Seems they are all bundled into the one event?
2
by: Hardy Wang | last post by:
Hi, I have a FileSystemWatcher object to monitor one certain folder on server. FileSystemWatcher watcher = new FileSystemWatcher(); watcher.Path = @"C:\MyFolder"; watcher.NotifyFilter =...
3
by: Krish | last post by:
Hello Gurus, Pardon me for asking dumb question... I wrote small csharp program to watch a folder for any created text file... When i try to run through debugger and stop after "...
2
by: Brad | last post by:
Hello All I am working on an application that watches a folder for incomming files. The files happen to be tif files from a fax card. When the file comes in I want to move it to a different file....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.