1、In the following VB program, please states any potential problem(s) and how to correct.Private Sub btnCalc_Click( )
Dim result As Integer
Try
Me.Cursor = Windows.Forms.Cursors.WaitCursor
result = Convert.ToInt32(txtInput1.Text) / Convert.ToInt32(txtInput2.Text)
txtResult.Text = result
Me.Cursor = Windows.Forms.Cursors.Default
Catch ex As Exception
MsgBox(ex.StackTrace)
Catch ex As ArgumentNullException
MsgBox("Input Test box cannot be null.")
Catch ex As OverflowException
MsgBox("Input Test box 2 cannot be zero!")
Catch ex As FormatException
MsgBox("Input Test box should be numeric format!")
End Try
End Sub2、
GetRecordset() is a VB function that returns a ADODB.Recordset object:
Ref_ID Qty Price
Row 0 00123 1000 60.50
Row 1 00123 2000 60.00
Row 2 00123 3500 59.50
Row 3 00124 3000 60.50
Row 4 00125 2000 59.50
Row 5 00125 1000 58.00 (This recordset is sorted by Ref_ID)The following program Dim rst as ADODB.Recordset
Rst = GetRecordset
Do While Not rst.EOF
Console.writeline(rst.Fields("Ref_ID") & vbcrlf & rst.Fields("Qty") & vbcrlf & rst.Fields("Price"))
rst.MoveNext()
LoopCan generate the following output:Output:00123 1000 60.50
00123 2000 60.00
00123 3500 59.50
00124 3000 60.50
00125 2000 59.50
00125 1000 58.00Please suggest how to modify the above program to generate the following output:Output:
00123 
1000  60.50
2000  60.00
3500 59.50
----  -----
6500 60.00
00124 
3000 60.50
----  -----
3000  60.50
00125 
2000 59.50
1000 58.00
----  -----
3000 58.753、
Module modFree
#Region "clsShape"
Public Class clsShape
Private m_Area As Double
Private m_Sides As IntegerPublic Sub New()
m_Area = 0.0
m_Sides = 0
End SubPublic Sub New(ByVal Sides As Integer)
m_Sides = Sides
End SubPublic Sub New(ByVal Area As Double)
m_Area = Area
End SubPublic Sub New(ByVal Area As Double, ByVal Sides As Integer)
m_Area = Area
m_Sides = Sides
End SubPublic Property Area() As Double
Get
Return m_Area
End Get
Set(ByVal Value As Double)
m_Area = Value
End Set
End PropertyPublic Property Sides() As Integer
Get
Return m_Sides
End Get
Set(ByVal Value As Integer)
m_Sides = Value
End Set
End Property
End Class
#End Region
#Region "clsTriangle"
Public Class clsTriangle
Inherits clsShapePublic Sub New()
MyBase.New(3)
End SubPublic Sub New(ByVal Area As Double)
MyBase.New(Area, 3)
End SubPublic Function CalculateArea(ByVal SideBase As Double, ByVal Height As Double, _ Optional ByVal AssignToArea As Boolean = False) As Double
Dim Area As Double = (SideBase * Height) / 2If AssignToArea Then
Me.Area = Area
End IfReturn Area
End Function
End Class
#End RegionPublic Sub Main()
Dim objTriangle As New clsTriangle
Dim objShape As New clsShapeobjTriangle.Area = -330
objTriangle.Sides = 5.5
objTriangle.CalculateArea(10.0, 2.5)objShape.Area = 123
objShape.Sides = -2
objShape = CType(objShape, clsTriangle)Console.WriteLine(TypeOf objTriangle Is clsShape)
Console.WriteLine(TypeOf objShape Is clsTriangle)
Console.WriteLine(objTriangle.Area)
End Sub
End Module7.1 Please find the line of code from the procedure Main to cause run-time error.Answer:7.2 Please write the result output from the procedure Main.