Chaim,
Whenever your cursor changes:
select TheGenXTabCursor
thisform.grdXTAb.ColumnCount = -1
this will tirgger the grid to rebuild itself.
One downside to this is though that you will lose all of the code and property assignments attached to the columns, headers and textboxes in the grid. If this is a problem, you can easily reapply property settings, or recontruct the grid using your own AddObject() calls. If you want some more help with this part, just post again.
>I have to do a form with grid.
>The grid source is genxtab cursor (sometimes 3 columns, sometimes 10 columns).
>How can I change the columns count and columns caption according the current cursor.