Local ix, tWidth, nParentWidth tWidth = 0 With oGrid For ix=1 To .ColumnCount With .Columns(m.ix) tWidth = m.tWidth + .Width Endwith Endfor nParentWidth = Iif(.Parent.BaseClass == "Page", .Parent.Parent.Width, .Parent.Width) If m.tWidth + 25 +.Left > m.nParentWidth - (.Left+1) .Width = m.nParentWidth - (.Left+1) Else .Width = m.tWidth + 25 .ScrollBars = 2 Endif EndwithPS: This code is extracted and modified from LocatorGrid class' Init method, which is in Grids.vcx of FoxyClasses. You can download and use FoxyClasses from below link if you want to (it comes with all the source code that you can read or modify) - and LocatorGrid might simply be what you are trying to do, check its samples and help.