[RESOLVED] Arguments to a public sub
I have a lot of MshFlexgrids in different forms and am tired of setting the grid size to match it's rows. So I have decided to make a public sub in a bas module and just pass the grids name, but am missing something.
maybe i'm getting brain dead, but i am having trouble getting this to work
Public Sub SetGridSize(ByRef grd As MSHFlexGrid)
With grd
.Height = .Rows * .RowHeight(.Rows - 1)' use the height of the last row
End With
End Sub
I am calling it like this: In form
SetGridSize DocGrid
but am getting a "wrong arguments or invalid property assignment" message
what is wrong ?
Re: Arguments to a public sub
add a check to make sure that .Rows is >0 before trying to use it in the formula...
-tg
Re: Arguments to a public sub
Quote:
Originally Posted by techgnome
add a check to make sure that .Rows is >0 before trying to use it in the formula...
-tg
I am calling it after i set the the number of rows.
In this case:
DocGrid.Rows = 6
Re: Arguments to a public sub
so, what line does the error happen on?
-tg
Re: Arguments to a public sub
Quote:
Originally Posted by techgnome
so, what line does the error happen on?
-tg
it happens right from the call:
SetGridSize DocGrid
Re: Arguments to a public sub
Have you tried stepping thru the code? Is DocGrid an MSHFlexGrid?
Re: Arguments to a public sub
Does the code work OK if this method is not in the module and rather in that form itself?
Re: Arguments to a public sub
Quote:
Originally Posted by dee-u
Have you tried stepping thru the code? Is DocGrid an MSHFlexGrid?
There is no stepping thru it. It happens at the call
SetGridSize DocGrid
I have also tried this: Call SetGridSize(DocGrid)
same error
Re: Arguments to a public sub
I tried on another grid in the same project and the same error
I tried on another project and it worked, I am stumped
Re: Arguments to a public sub
You seem to have missed this question:
Quote:
Originally Posted by dee-u
Is DocGrid an MSHFlexGrid?
Note that MSHFlexGrid is not the same as MSFlexGrid.
You should also check if there are any other routines called SetGridSize, as it may actually be a different one which is being called.
Re: Arguments to a public sub
Quote:
Originally Posted by si_the_geek
You seem to have missed this question:
Note that MSHFlexGrid is not the same as MSFlexGrid.
You should also check if there are any other routines called SetGridSize, as it may actually be a different one which is being called.
Just tried your suggestion, i thought a longshot, but
There was another SetGridSize, that was being used by an ocx
ActiveResize1_ResizeComplete. Thanks