Blog Task: Types of errors
Syntax Errors: Syntax errors are the misspellings or not using the right language element properly in your code. For Example: using the wrong spelling in a variable that you have declared above the rest.
Run-Time Errors: They appear after you start up the program. The code and syntax maybe correct but it just won’t run. For Example: having a file being loaded into or by the program but the file path is invalid or corrupted.
Logic Errors: These are results that the program wasn’t expecting or wasn’t needed. These are the hardest errors to fix. For Example: if someone types in the wrong word or number that is outside the parameters.
Blog Task: Name that function
The name of the Visual Basic function that we could use to ensure that only numeric data is assigned to the integer variable would be IsNumeric.
The OverFlowException error occurs because the number is not within the largest number and the lowest number so therefore the program cannot use the number and crashes
The range/capacity of the integer is 2147483647 to -2147483648
Blog Task: Warnings
The warning given when using variables before they have been assigned a value is the following: “variable ‘ThisPlayer1’ is used before it has been assigned a value. A null reference exception could result at runtime” it looks like a green wavy line under the variable.
Blog Task: Looping through the array
The upperbound of the array in the “IndexOutOfRangeExceptionDemo” is 2 (which means 3). There are 3 elements that are contained in the array. I suggest that the starting value should be 0 and the ending value should be 2. The code that is shown in figure 4 is producing that error because the “for” statement has an ending value of 3 instead of 2. The message box in the second iteration is “string 2”
Blog Task: Mismatched data
The invalidcastexception occurs because the text in the textbox is supposed to be a integer and not a string. If I enter a number within the integer range nothing happens. The correct data type to store a string in is string. The correct data type to store a number in is an integer. You can actually store a number in a string, because some numbers don’t need adding, subtracting etc.

No comments:
Post a Comment