arraylist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • readbanana
    New Member
    • Jul 2010
    • 37

    #1

    arraylist

    I have a column in my database where everything is separated by columns. I pull this coulmn out and use the split function to separate it by the commas and place each word(s) on a separate label. when a user wants to add a word to the column, they type it into a textbox and it inserts it into the column with a comma before it so now the words say 'hi, how are, you' when they want to delete a word they click a button which replaces that word and it's comma with nothing ''. the problem is that the last word does not have a comma after it, so it can't be deleted. if I add another comma at the ed so the it says 'hi, bye, how are you,' then an extra label is filled with nothing and now my page has a blank label with a button next to it. if i erase the last thing in the array, then (to get rid of the blank) then sometimes, depending on what the user did, it doesn't display a word that it really should. I'm not exactly sure why. i hope i'm being clear
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    Can you use a simple test to see if what you're deleting is the last item, and if so, doesn't delete the comma?

    How are you deleting the item from from your array list? By index with a string.Remove call?

    Comment

    • readbanana
      New Member
      • Jul 2010
      • 37

      #3
      when the user chooses to delete a word it doesn't have to be the last one. but if he does choose to delete the last one, this comma was giving me a problem.
      in the array, i was having it count the items in the array and then removeat(count-1)

      Comment

      • readbanana
        New Member
        • Jul 2010
        • 37

        #4
        I got it. to add i have them update with a comma before and after (,hi,bye,how are you,)
        to delete they replace ,word, with a comma (,hi,bye,)
        then i delete from the array the first at last so it shows up (hi bye) instead of (' ' hi bye ' ')
        thanx for your help anyway

        Comment

        Working...