Jump to content

Recommended Posts

Okay, This code actually works.. but it is Ridiculously slow. (and I know, I know.... Don't use goto.. :/ )

 

well, For some reason the ListView control isn't enumerable(I've read somewhere you can add in functionality, but I'm still a noob.)

 

Anyway.. I'm wondering if anyone has a better alternative for this, or can help me correct my code, to make it faster.

 

DreamWords is the ListView object.

 

   int curind = 0;
            int cntdw = (DreamWords.Items.Count - 1);
            int innerind = 0;
            int Dup = 0;
            DreamWords.Focus();
            while (curind <= cntdw)
            {
                cntdw = (DreamWords.Items.Count - 1);
                DreamWords.Items[curind].Selected = true;
                string curword1 = DreamWords.SelectedItems[0].Text;
                curind++;
                while (innerind <= cntdw)
                {
                restart:
                    ;
                    cntdw = (DreamWords.Items.Count - 1);
                    if (innerind > cntdw) { innerind--; goto restart; }
                    DreamWords.Items[innerind].Selected = true;
                    string curword2 = DreamWords.SelectedItems[0].Text;
                    if (curword2.Equals(curword1)) { Dup++; }
                    if (Dup == 2) { DreamWords.SelectedItems[0].Remove(); curind = 0; }
                    innerind++;
                }
                Dup = 0;
                innerind = 0;
}

Well I Figured it out a couple days ago, forgot about this post. .. if anyones interested or just in case someone else has this problem ever -

 

The solution was to dump the list into an ArrayList Object, which has some awesome functions ..

 

Much Much faster also.

 

http://www.dotnetspider.com/kb/Article17.aspx

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.