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

Posted on 2008-11-11
Last Modified: 2013-11-26
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  
Question by:nosurf2day
    LVL 53

    Accepted 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.


    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

    Author Closing Comment

    Great source information, thanks alot

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now