S
Steve
I am working on a program that works like a check in/check out
system. There is a folder on a network drive that stores a bunch of
vb programs. This program will check in and check out programs and
store them locally on the user's machine. I want to be able to tell
if a program is checked in or checked out. I am doing this by writing
to a text file a 1 if it is checked in or a 0 if it is checked out. I
am using StreamReader to read the first line in the text file and
storing the value in a string (status). I think what I am doing wrong
is that I am getting the total number of items in this list box and
when I remove an item from the list box, the total number of items in
the list box doesn't reflect an item being removed. This is the error
I am getting:
InvalidArgument=Value of '4' is not valid for 'index'.
Parameter name: index
I am stuck with trying to re-initialize my count to show that an item
has been removed. Any suggestions would be greatly appreciated.
I am using Visual Basic 2005 Express, Framework 2.0.
-----------------Begin Code-----------------
file_count = lstCheckedInProjects.Items.Count
For item = 0 To file_count - 1
If Directory.Exists(DestPath &
lstCheckedInProjects.Items(item).ToString) Then
StreamReader = New StreamReader(DestPath &
lstCheckedInProjects.Items(item).ToString & "\" & status_file)
status = StreamReader.ReadLine()
If status = "0" Then
lstCheckedInProjects.Items.RemoveAt(item)
End If
StreamReader.Close()
End If
Next
----------------- End Code -----------------
system. There is a folder on a network drive that stores a bunch of
vb programs. This program will check in and check out programs and
store them locally on the user's machine. I want to be able to tell
if a program is checked in or checked out. I am doing this by writing
to a text file a 1 if it is checked in or a 0 if it is checked out. I
am using StreamReader to read the first line in the text file and
storing the value in a string (status). I think what I am doing wrong
is that I am getting the total number of items in this list box and
when I remove an item from the list box, the total number of items in
the list box doesn't reflect an item being removed. This is the error
I am getting:
InvalidArgument=Value of '4' is not valid for 'index'.
Parameter name: index
I am stuck with trying to re-initialize my count to show that an item
has been removed. Any suggestions would be greatly appreciated.
I am using Visual Basic 2005 Express, Framework 2.0.
-----------------Begin Code-----------------
file_count = lstCheckedInProjects.Items.Count
For item = 0 To file_count - 1
If Directory.Exists(DestPath &
lstCheckedInProjects.Items(item).ToString) Then
StreamReader = New StreamReader(DestPath &
lstCheckedInProjects.Items(item).ToString & "\" & status_file)
status = StreamReader.ReadLine()
If status = "0" Then
lstCheckedInProjects.Items.RemoveAt(item)
End If
StreamReader.Close()
End If
Next
----------------- End Code -----------------