Hi,
I have a question about the performace issue of byref. I have a senerio where I want to pass a dynamic datagrid and an SQL data reader over to a sub using ByRef. The reason for this is for code reuse, I have up to 30 dynamic grids to process and 30 data readers.
By making my code more readable for myself, am i getting a performance penalty? would i be better expressing it as a prodedural type script of say 800 lines, or reuse with byref and get my code down to about 40 lines?
Speed is critical in this application.
A simplified example written to demonstrate, not real code.
Sub1()
For i = 0 to 30
Dim tGrid As DataGridView
tGrid = GetControlByName("grd" & UpdateReader("LeagueID"))
GameReader = createreader("SELECT * FROM Games WHERE LeagueID='" & UpdateReader("LeagueID") & "'")
GameReader.Read()
Sub2(tGrid,(i*7),GameReade
r)
Next i
End Sub
Sub2 (ByRef tGrid as DataGridView,ByVal ColumnOffset as integer,ByRef tReader as SQLDataReader)
'### large amount or processing and data manipulation on grid
tGrid.Rows(0).Cells(1+Cell
OffSet).Va
lue = tReader ("A Value")
End Sub
Start Free Trial