Error when loading table how to avoid

Discussion in 'Questions (Windows Mobile)' started by tvrman, Aug 4, 2007.

  1. tvrman

    tvrman Member Licensed User

    I'm busy for serveral hours to find the solution for the below issue which
    i'm can't solved yet.

    When a table is loaded with data like files (filesearch), the table is loaded
    with the file names of the current directory, that's works fine.
    When i do an reload the table will start at the top and the error starts
    with that it's not possible to use dublicate names in the table.
    (of course starting with clear table is one solution), what i want is
    that the filesnames in the table will stay and not changed anymore,
    this make it possible to reload the directory and only the files which added
    will be added to the table.
    I have tried to errorlabel and create serveral sub's with variable all of them
    will not work now. the errorlabel will brake out of the loop and comes never back.

    Is there one solution to compare the data from the filesearch with the table and
    only the difference or new filenames will be added to the table:sign0085:
  2. Erel

    Erel Administrator Staff Member Licensed User

    You could add duplicate items to a table (unless you have set the column unique property).
    I guess that you don't want to show duplicate values.
    You can store the file names in an ArrayList and then check if a name exists using: if ArrayList.IndexOf(newFile) > -1 then ...
  3. tvrman

    tvrman Member Licensed User

    Greate Erel ,

    i have used your advise Arraylist see below code

    ' load the arraylist to compair.
    for counter = 0 to table1.RowCount - 1
    Arraylist2.Add (Table1.Cell("Files",counter))

    for I =0 to al1.count - 1

    'Compair with exist data in table which is loaded in arraylist2 at the start
    If ArrayList2.IndexOf(Substring (s,c,strlength(s)-c)) > -1 then
    Table1.AddRow (Substring(s,c,strlength(s)-c),s)
    End if




  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice