Hi, I have a database system which works by entering a customers first name and second name, a1, a2, a3, postcode, etc..... each customers information is stored in separate *.txt files generated using the first and second name of the customer. deleting the customer files them self are not the problem as I use a simple KILL statement (if this is the wrong way to go about this please let me know)

The the .txt file I am having trouble with is the one I am using to hold all the full names. these are writin out each time a customer is added and are placed on a new line every time and I should point out that they are being writin (as APPEND) as one STRING each time, which is takin from both the first and second name (text boxes)

here is the code for the txt (that writes out the customer names):

Code:
Dim CustomersNames(0 To 999999) As String
Code:
Dim i As Integer
    i = 0
        Open "CUSTOMERS_NAMES.TXT" For Input As 1#
            Do While Not EOF(1)
                Input #1, CustomersNames(i)
                cmbFindCus.AddItem CustomersNames(i)
            Loop
                cmbFindCus.Text = CustomersNames(0)
        Close #1
End Sub
here is the same file but for input into the program:

Code:
Dim i As Integer
    i = 0

    Open "CUSTOMERS_NAMES.TXT" For Input As 1#
        Do While Not EOF(1)
            Input #1, CustomersNames(i)
            cmbFindCus.AddItem CustomersNames(i)
            i = i + 1
        Loop
            cmbFindCus.Text = CustomersNames(0)
Close #1
and finally this is how I am trying and failing to delete one of the entity's:

Code:
Dim i As Integer
i = 0

Kill (App.Path & "\" & cmbFindCus.Text & ".txt")

Open "CUSTOMERS_NAMES.txt" For Output As 1#
    Do While Not EOF(1)

        If i = cmbFindCus.ListIndex Then
           Write #1, (cmbFindCus.Text); (cmbFindCus.ListIndex)
           i = i + 1
        End If

Write #1, CustomersNames(i)
           i = i + 1
    Loop

cmbFindCus.Text = CustomersNames(0)

Close 1#
I should also add that when I test using this code it deletes everything that is in the file.

Thanks in advanced, Seditives