VB NOTES PART 16 - Inside catch: messageBox.Show (You...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
3/31 ---Exception Handling Exception: problem that happens at run-time may cause program to crash (Happens when all the programs are running which result to crash your program) E.g. dividing by zero We say that the program throws an exception-your code can choose to catch it. -----use a Try block Try . . ‘Regular code Catch (If you just say Catch, it gets any type) . ‘Error handling code . Finally . Optional . ‘Cleanup code End Try ……could be……. Catch formatExceptionParameter As FormatException Exception inside Try Control goes to Catch Finally block, if it’s there o Can also re-throw Throw formatExceptionParameter
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Inside catch: messageBox.Show (You messed up, Error, MessageBoxButtons.OK, MessageBoxIcons.Error) Error You messed up OK mystring.Substring (2)---starts from index 2, goes to end Mystring.Substring (0, 2)---starts from index 0, goes 2 characters Dim mystring As String =51016 Dim test As String Test =mystring.Substring (2) = 016 Test = mystring.Substring (1, 2) = 10 Test = mystring.PadLeft (7, Convert.ToChar (3) = 3351016 Add 3s on the left until string has length 7 also a PadRight String.Format ({0:D2}: {1, D2}, myString1, myString2)...
View Full Document

Page1 / 2

VB NOTES PART 16 - Inside catch: messageBox.Show (You...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online