-1

I have just finished writing my first visual basic "Windows Form Application" that took me several days and that comprises several hundred lines. I learned every concept from scratch, when I encountered it.

Now, all errors the "IntelliSence" can detect has been corrected. The application runs smoothly. But the result is not correct! -- Actually, in one occasion, without changing anything, when I simply inserted a break point and then continued the running, the result appears to be different and appears correct! (i.e., apparently, different results without changing anything)

Without further details (it's several hundred lines, hard to explain...) can anyone tell me what to do next?

Or, more specifically,

question #1, how can I keep track of a certain variable (that variable should have remained unchanged throughout the application)?

And

question #2, what is the shortcut for step-by-step execution in Visual Studio, equivalent to the F8 shortcut in Microsoft Office VBA??

I'm trying to count the total number of new words in a text, and the frequency of each; and then two consecutive words and the frequency of each, taking into consideration only the non-unique words on the basis of the previous count; and then three consecutive words; and then four... until the consecutive words no long repeat. In this process, I discovered that:

Firstly, Microsoft Office "word count" is in fact more accurately a "words-times count" in a sense such as "Our park received (a certain number of) people-times (in stead of just 'people') of visitors per day".

Secondly, some say the count of words in a text, after eliminating repetition, is the count of "unique words" -- that is not accurate, either. In descending order by occurrences / frequencies, the words are "common words", "rare words" and finally "unique words" which means "extremely rare (occurring only once)". What was thought as "unique words" are actually "new words", which is termed correctly in SDL Trados.

Meaning of new: "How many words appeared for the first time in the scope of this text?
Meaning of unique: "How many words appeared only once in the scope of this text?


I have located (or identified) the problem by now. The problem is in "Top Design" (or something). The code is entirely fine (or correct) even with: 612 lines, 57 members/types, a depth of inheritance of 7, and a project maintainability of 87 according to Visual Studio Code Analysis.

On the "top level", I suspect the problem becomes a "real world" problem and no longer about programming. It becomes a question of everyday life or work, generally "How can do this or that?"

Maybe found in between "real world problem" and "programming problem", my "top level" problem at hand, if I may still state it here, is that --

When I found the repetitious "single word" and extended it by one word to look for repeatitious "two consecutive words", I extended only its first occurrence and that was incomplete.

For example, if the text is "my computer my computer my document my document" the repetitious single-words are "my, 4 times", "computer, 2 times" and "document, 2 times". Then, I extend "my" by one word and check if "my computer" is repetitious. It is; the code gives "my computer, 2 times". Thereby I missed "my document, 2 times".

Jixin Wei
  • 41
  • 6
  • Use a constant for a variable that should be unchanged. – Ananta Feb 21 '18 at 08:24
  • for step by step debugging you can use f10 – ArunPratap Feb 21 '18 at 08:24
  • @Jixin Wei: you'll receive downvotes, because you violate StackOverflow rules on how to ask questions. Question should be containted in title. – Piotrek Feb 21 '18 at 09:49
  • @Ananta: it is a string variable, assigned only once, but used many times, not sure whether one of the "using" changed it. – Jixin Wei Feb 21 '18 at 10:05
  • Start [here](http://csharp.net-tutorials.com/debugging/introduction/). – Sinatr Feb 21 '18 at 10:07
  • @JixinWei Maybe you could use the readonly keyword. It is the same as the const keyword except that you can set its value in the constructor. https://learn.microsoft.com/fr-fr/dotnet/visual-basic/language-reference/modifiers/readonly – Ananta Feb 21 '18 at 10:35

1 Answers1

0

Question #1: Use a (quick)watch. https://msdn.microsoft.com/en-us/library/0taedcee.aspx?f=255&MSPPError=-2147217396

Question #2: F11: Step into https://msdn.microsoft.com/en-us/library/y740d9d3.aspx

Good luck! and for the next time, please include code so that people can read and try themselves and try to stick to one issue/question at a time :)

JP Hellemons
  • 5,977
  • 11
  • 63
  • 128