Sunday, September 18, 2011

[Research] Visual Basic - The Object Class


There is a class called X that contains the following overridable methods:
Run()
Walk()
Hide()
There is a class Y that inherits from class X. Is Y able to override the Run, Walk & Hide methods in X?
Yes, Y can override the methods from class X, since X is the parent. X can call it's own functions even if Y overrides them, but Y if it overrides X's methods cannot access X's original methods only the newly written overriding one.

[Code] Visual Basic - GameSignUp Inheritance

What is the base class of the user class (GameSignUp.vb) you have created?
GameSignUp is based solely off the Object class.


Which methods does your user class (GameSignUp.vb) inherit from this class?
Equals(Object)
Equals(Object, Object)
Finalize()
GetHashCode()
GetType()
MemberwiseClone()
ReferenceEquals()
ToString()

[Research] Visual Basic - ToString

The ToString for my GameSignUp class output "GameSignup.GameSignUp". This was actually fairly useful as it states the owner and the class, so I can tell it is an object of GameSignUp in the solution GameSignup.

[Research] Visual Basic - The Object Class

What is the purpose of the object class?
The Object class is the ultimate "parent" class, all objects are based off it. It's the root of type hierarchy.

How many constructors does it contain?
Just one.

How many methods does it contain?
It contains 8 methods.

What is the purpose of the ToString method?
ToString outputs a string that is basically the "name" of the object.

Monday, September 5, 2011

[Research] Visual Basic - Debugging (Types of Errors)

There are 3 types of Programming errors;
Syntax - Literally the user writing bad code, or code the compiler does not understand. An example of this is that you cannot write a Procedure block within a Namespace block.
Run-Time - Errors that appear as the program runs, due to errors that were not picked up by syntax, eg giving a function bad parameters.
Logic - These are not "Errors" that the compiler throws, rather, unwanted output. Eg, dividing a rectangle's width by height to get area instead of multiplying them.

The Error List window displays Syntax errors.

Monday, August 29, 2011

[Research] Visual Basic - String Manipulation

StrComp-
Overloads: 0
Parameters: String1:String, String2:String, Compare:CompareMethod
Return type: Integer
Exceptions: ArgumentException
Details:
StrComp compares String2 to String1, based on the (optional) Compare parameter. If String1 comes BEFORE String2 (in order), the return will be a -1, if they are the same, it will return a 0, if it comes AFTER String 2, it will return a -1.


StrConv-
Overloads: 11
Parameters: str:String, Conversion:VbStrConv, LocaleID:Integer
Return type: String
Exceptions: ArgumentException
Details:
StrConv converts str using the VbStrConv function. for example. VbStrConv.LowerCase will return a string with all lower case letters.


StrReverse-
Overloads: 0
Parameters: Expression:String
Return type: String
Exceptions: N/A
Details:
StrReverse just reverses the order of the entire string.



StrTrim-
Overloads: 0
Parameters: str:String
Return type: String
Exceptions: N/A
Details:
StrTrim removes all leading and trailing spaces. ie, no spaces at the start, or at the end of the string.


Strings.Join-
Overloads: 0
Parameters: SourceArray:String, Delimiter:String
Return type: String
Exceptions: ArgumentException
Details:
Strings.Join will get all the values, or the specific value, from an array or string, and add them together. The Delimiter will add a certain characters (default a space) between each item that is joined. If an array has the numbers 1 to 10, and the delimiter was a colon ":", the output would be 1:2:3:4:5 etc.

Strings.Replace-
Overloads: 0
Parameters: Expression:String, Find:String, Replacement:String, Start:Integer, Count:Integer, Compare:CompareMethod
Return: String
Exceptions: ArgumentException
Details: This function replaces certain strings or characters with others, within a source string. Count counts how many have been replaced. Start is the integer location of the start of the string to search to replace.

Monday, August 22, 2011

[Research] Visual Basic - Try/Catch Block

In Exception Handling, the Try/Catch block is a large nested If loop that checks for Exceptions, and if they are found, how to deal with them.