VB6 求最小值的问题?求高手解答
'模块Sub CountMSFlexGrid(MSFlexGrid1 As MSFlexGrid, RowStart As Long, RowTo As Long, ColStart As Long, ColTo As Long, MAX As Integer, MIN As Integer) Dim Row As Integer, Col As Integer For Row = RowStart To RowTo For Col = ColStart To ColTo MAX = IIf(MAX < Val(MSFlexGrid1.TextMatrix(Row, Col)), Val(MSFlexGrid1.TextMatrix(Row, Col)), MAX) '返回最大值 MIN = IIf(MIN < Val(MSFlexGrid1.TextMatrix(Row, Col)), MIN, Val(MSFlexGrid1.TextMatrix(Row, Col))) '返回最小值 Next NextEnd Sub'窗体Private Sub Command3_Click()Dim MAX As Integer, MIN As IntegerCountMSFlexGrid MSFlexGrid1, 1, 20, 1, 20, MAX, MINText1.Text = MAXText2.Text = MINEnd Sub
MAX=Val(MSFlexGrid1.TextMatrix(RowStart, ColStart))MIN=MAX