I made an Electronic Dictionary for a college project and it's around 85-90% done. The two final issues I'm having is to figure out how to get a count on each individual word ( there are over 1000 words ), keep track of each of them, and display them ( this ill just throw in a message box with the definition of the word at the end that's no problem ). Obviously I'm using an array to search for the words which are in a text file in the debug folder etc. Just can't rap my head around the counting and more so the tracking of each time a word that has been successfully searched for.

Second problem, definitely a dumb question, but for the life of me I figure it out. I have to make it able to add a word/def, modify a word/def, and obviously search for a word/def and i have that setup and working fine. The problem comes when I try to do any of those three things twice, I can only do one of those once, and after that everything else locks up.

Bonus question - Port the program to a PDA or cell phone? I'm told that's possible, if you know how I'll love you long time but it's of zero concern compared to the first two questions I can't figure out.
~Thanks y'all i tried to be as detailed as i can, the project is freaking massive so I can't really put any specific code in here yet. :)

Edited 7 Years Ago by __avd: Improved formatting.

Upload your project. How you go about doing what you are asking depends a lot on how you designed the application.

Greetings,

I think the most important point in a project if it works well. So, I do not know if you can restart your project, but I think using database would be easier to finish this project successfully. You could count all the words easier and add new words easier and avoid to add a word which was added already etc. And I think it would not take so long time, you could finish its programming part at most in several days, the hardest step would be adding words to your database.

If you had any error to add your database to your setup project you would add your database manually to the computer your program will run.

I wish in the shortest time you can finish your project successfully.

Take care.

Greetings,

I think the most important point in a project if it works well. So, I do not know if you can restart your project, but I think using database would be easier to finish this project successfully. You could count all the words easier and add new words easier and avoid to add a word which was added already etc. And I think it would not take so long time, you could finish its programming part at most in several days, the hardest step would be adding words to your database.

If you had any error to add your database to your setup project you would add your database manually to the computer your program will run.

I wish in the shortest time you can finish your project successfully.

Take care.

Uhm, no.
Anyway the main problem is once I execute the code individually it works only once, after that the lookup, the adding a word, and the modifying the word do nothing. When I modify the word and click the add button to get the modified word/definition/usage of the word back into the text file i get an IO error, that says the Streamwriter is in use, and yea i closed all the Readers that the add and modifier buttons use.

Edited 7 Years Ago by redstrykr: n/a

I can't figure out how to use the application. I was able to log in but I can't figure out how to pull up an existing word. Can you give a detailed walk through?

I can't figure out how to use the application. I was able to log in but I can't figure out how to pull up an existing word. Can you give a detailed walk through?

Ya i cut out most of the words but what i left was in the txt file with the users file. The text box right above the lookup button will pull up any word in the file, Integer is the first word try that as a test. The top left text box is for adding or modifying an existing word. But like i said you can only do each of them once ( 90% of the time ), then everything locks up.

Edited 7 Years Ago by redstrykr: n/a

Ya i cut out most of the words but what i left was in the txt file with the users file. The text box right above the lookup button will pull up any word in the file, Integer is the first word try that as a test. The top left text box is for adding or modifying an existing word. But like i said you can only do each of them once ( 90% of the time ), then everything locks up.

Wouldn't let me edit my posts for w/e reason.. :icon_neutral:
Anyway I Fixed the " Code only working once " issue.
Only problem I'm having now is getting everything counted on the lookup part.

Edited 7 Years Ago by redstrykr: n/a

Significantly better as far as functionality goes. Not sure if im on the right track with the counting each word in the array or not, having problems with the Erasing the lines in the text file that relate to the word being looked for to modify then obviously subsequently adding it back in. Adding shouldn't be hard to figure out, just can't quite figure out the first couple things.

This is a cut-out of the project I want to, when the user clicks modify, to have the definition and usage of the word get pasted into the text box, I have that working.
But then I need the word line in the text file to be erased... if the word they enter to modify is found the following code is executed, any ideas?

if (WordFound == true)
                    {
                        txtDef.Text = WordList[1].Trim();
                        txtEx.Text = WordList[2].Trim();
                        //try
                        {
                            StringBuilder EraseMod = new StringBuilder();
                            string store = "";
                            //string store1 = "";
                            //string store2 = "";
                            string[] GetFile = File.ReadAllLines("Words.txt");
                                foreach(string line in GetFile)
                                {
                                    if (line.Contains(txtAdd.Text.Trim()))
                                    {
                                        store = line.Remove(0);
                                        EraseMod.Append(store);
                                        continue;
                                    }
                                    EraseMod.Append(line);
                                }
                                DictionaryReader.Close();
                                File.WriteAllText("Words.txt", EraseMod.ToString());
                                   
                        }
                        //catch
                        {
                            
                        }
                    }

If you are trying to remove the line then dont add it to the EraseMod:

if (line.Contains(txtAdd.Text.Trim()))
     {
          continue;
     } 
 EraseMod.Append(line);

Alternatively, you can replace the line with the modified one:

if (line.Contains(txtAdd.Text.Trim()))
     {
          EraseMod.Append("modified text here");
          continue;
     } 
 EraseMod.Append(line);
This article has been dead for over six months. Start a new discussion instead.