vb.net面试题,请大家帮忙,谢谢。

来源:百度知道 编辑:UC知道 时间:2024/05/08 18:11:56
前三道我做的差不多了,实在实力有限,请大家帮忙啊,就这么多积分全拿出来了,谢谢了。
Question 4
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 Sub

Question 5

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

如果需要讲详细一点,那就加我QQ531412815

第4题,潜在的错误,这里的错误不是常规错误,属于那种只有在运行是才知道的错误:
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!")
结构化错误处理永远达不到下面这里,因为Catch ex As Exception 已经处理了所有错误.

第5题:
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.75
就是按照Ref_ID 分类,有一种方法就是按照Ref_ID 分组,也就是使用SQL语言,不过这里需要该很多,

我就不用了,那么就稍微复杂一点,使用FIND方法,不过有一点必须注意REF_ID必须排序,因为数据库中

已经排好序了,我就不用排了。
Dim rst as ADODB.Recordset
dim refID as string
Rst = GetRecordset