InvalidCastException Constructor
Initializes a new instance of the InvalidCastException class.
Assembly: mscorlib (in mscorlib.dll)
This constructor initializes the Message property of the new instance to a system-supplied message that describes the error, such as "Cannot cast from source type to destination type." This message takes into account the current system culture.
The following table shows the initial property values for an instance of InvalidCastException.
|
Property |
Value |
|---|---|
|
A null reference (Nothing in Visual Basic). |
|
|
The localized error message string. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Dim mark As Single
mark = TextBox1 . Text
Select Case mark
Case 0 To 49
Label1 . Text = "E"
Case 50 To 59
Label1 . Text = "D"
Case 60 To 69
Label1 . Text = "C"
Case 70 To 79
Label1 . Text = "B"
Case 80 To 100
Label1 . Text = "A"
Case Else
Label1 . Text = "Error, please reenter the mark"
End Select
End Sub
- 11/18/2011
- dwgossen