Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 175
  • Last Modified:

Exam coming up, I have questions I need help answering.

4. How to throw an exception.
         - Why would you want to throw an exception?

5. How to work with Arrays
-      How to assign values to the elements of an array
          - Does this mean when I code:
                 Dim totals (3) As Decimal
                 totals (0) = 14.95D
                 totals (1) = 12.95D....ect
            The values are the 0, 1, 2, 3?  
            Or are the values the 14.95, 12.95....ect?

6. How to use LOOPs to work with array:

I know the code below is putting the numbers 0 through 9 into an array.  But what exactly is this telling me?     Can show an example?
    Dim numbers (9) As Integer
    For i As Integer = 0 To numbers.Length - 1
          numbers (i) = i

7. How to refer to and copy arrays
My professor had this example on his slide.  I dont understand how this works at all!

Code that creates a reference to another array
Dim inches1() As Double = {1, 2, 3}
Dim inches2() As Double = inches1
inches2(2) = ???  ({3})            
inches2(1) = 5  

then inches1(1) = 5  
1 Solution
4. You can explicitly throw an exception using the throw statement. You can also throw a caught exception again using the throw statement. It is good coding practice to add information to an exception that is rethrown to provide more information when debugging.

The following code example uses a try/catch block to catch a possible FileNotFoundException. Following the try block is a catch block that catches the FileNotFoundException and writes a message to the console if the data file is not found. The next statement is the throw statement that throws a new FileNotFoundException and adds text information to the exception.

Source: http://msdn.microsoft.com/en-us/library/xhcbs8fz(VS.80).aspx

5. Working with arrays: practical example:

6. Looping through arrays.
Example given is a very easy example to show how you can fill an array or to retrieve all the values in an array

7. Copying arrays: Fun with VB.NET Arrays
nosurf2dayAuthor Commented:
Great source information, thanks alot

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now