Results 1 to 3 of 3
  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012

    Running String Search Count?

    Had this issue I was wondering about. This is what it actually DOES then Ill say what I want it to DO. It grabs the word from a notepad I have saved in the directory, and brings it forward onto a form in designated area's and after whoever is done with the word and definition. It'll tell you how many times it's been looked up. Problem is the count applies NOT to the individual words as I'd have liked but EVERY word that has been searched for in the session.: Here's a snip-it
                            WordList = Word.Split('_');
                            WordListCount = Word.Split('_');
                            if (WordFound == true)
                                MessageBox.Show("The word " + WordList[0] + " means" + WordList[1] + WordList[2]);
                                for (Clicks = 0; Clicks < 1; Clicks++)
                                    ClickCount = ClickCount + 1;
                                MessageBox.Show("The word " + WordList[0] + " has been searched for " + ClickCount + " time(s)");
    I would greatly appreciate any insight as to how to get the count to apply for each word individually. Either just within the session or, if possible, keep a constant running total of searched words.
    Last edited by Redwit; May 10th, 2012 at 05:45 PM. Reason: grammar nazis made me do it

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Sydney, Australia

    Re: Running String Search Count?

    You should use a Dictionary<string, int> where the key is the word and the value is the count.

    On a non-programming note, your attempt at good grammar has gone awry I'm afraid, because that should have been "whoever" rather than "whomever". It's quite easy to know when to use which because one is used as the subject and one as the object. If you would use "I" when talking about yourself then you would use "who" when talking about a non-specific other. Likewise, if you would use "me" then you use "whom". E.g. "Who gave it to me?" and "I gave it to whom?". Red for subject and blue for object.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    Frenzied Member MattP's Avatar
    Join Date
    Dec 2008

    Re: Running String Search Count?

    This pattern in common to all great programmers I know: they're not experts in something as much as experts in becoming experts in something.

    The best programming advice I ever got was to spend my entire career becoming educable. And I suggest you do the same.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

By using this site, you agree to the Privacy Policy