I have a simple subroutine SortRows, which takes a DataGrid and a sort
expression and is supposed to set the DataGrid to sort by the sort
expression. In fact, all it consists of is:
Public Sub SortRows(ByRef Grid As DataGrid, ByVal SortExpression As String)
Grid.Attributes("SortExpr") = SortExpression
End Sub
When I tried calling this subroutine and set a breakpoint at the End Sub, I
found that the value of Grid.Attributes("Sort_Expr") was indeed equal to the
value of SortExpression. But after I returned to the calling subroutine, I
found that the value of SampleGrid.Attributes("Sort_Expr") was a blank
string. It seems to me that even though the Grid argument is declared
ByRef, for at least its attributes it behaved as though it was declared
ByVal.
Is there any possible implementation of this subroutine that uses only the
information in its arguments? I know that this is a simple subroutine but
maybe in the future I will have the same problem with a more complex one.
Bob Rosen
|