Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to re-create all columns in grid
Message
 
 
À
14/09/2001 13:49:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00556193
Message ID:
00557022
Vues:
26
Hi!

Then, you can remove comboboxes before you change the grid columns. Something like
for i=1 to grid.ColumnCount
  if eval("Grid.Columns(i)." + Grid.Columns(i).CurrentControl+ ".BaseClass") == "ComboBox"
    with eval("Grid.Columns(i)." + Grid.Columns(i).CurrentControl
      .Visible = .F.
    endwith
    Grid.Columns(i).RemoveObject(Grid.Columns(i).CurrentControl)
  endif
endfor
BTW, just an idea - did you tried to set the Visible = .F. for grid for the moment when you change its columns? Try this simple idea and let us know if it helped.

>I don't want to change grid recordsource. I want only to add new columns to grid. Currently I use the below. I read your article but haven't found any hind how to change this code.
>I found that C5 error occurs ONLY if grid contains combobox. If grid contians only textboxes, c5 error does't occur.
>
>
>* Form ChangeGridLayout() method.
>this.MousePointer = 11
>_screen.mousepointer = 11
>this.cmdFormSwitch1.setfocus()
>this.gridbase1.columncount = 0
>this.cmdFormSwitch1.FindNextLayout(thisform.brtabel)
>this.gridbase1.Init()
>this.gridbase1.setfocus()
>this.mousepointer = 0
>_screen.mousepointer = 0
>
>
>>Hi!
>>
>>Use the grid reconstruction behaviour ;)
>>Tr following code and let us know if it works:
>>
>>
>>* close old alias
>>select (Grid.RecordSource)
>>use
>>* here grid lose all its columns
>>Grid.ColumnCount = -1
>>Grid.RecordSource = "NewAlias"
>>Grid.Refresh
>>
>>
>>More about grid reconstruction you can read in the VFP Grids article in the UT magazine, August issue.
>>
>>HTH.
>>
>>
>>>I have a command F3 "change grid form" in my form.
>>>This command destroys all grid columns and then adds new columns to grid.
>>>
>>>To destroy columns I use
>>>
>>>
>>>  this.gridbase1.columncount = 0  && C5 error occurs in this line
>>>
>>>
>>>I tried also
>>>
>>>
>>>  DO WHILE this.gridbase1.columncount>0
>>>    this.gridbase1.DeleteColumn   &&& C5 error occurs in this line
>>>    ENDDO
>>>
>>>
>>>Using those commands in VFP 7 will cause C5 error sometimes. This works in VFP 5.
>>>
>>>Is there a way to re-create grid columns to avoid C5 error ?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform