Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Build Grid Object at run time 1

Status
Not open for further replies.

COBART

MIS
Sep 7, 2000
33
0
0
ID
Hallo ... any body can you help me

I create form with grid object, but when i want to lot of change, the grid error .
And Now I want to create grid with command . but idont know to create grid with command ?

Can you help me pleash ? give me the code program !!!

Thanks

Rudi


 
Ok, catch it ;)

thisform.AddObject('Grid1','Grid')
with thisform.Grid1
&& assign main thing - data source
.RecordSource = "MyAlias"
.ColumnCount = 10

&& define control sources - what each column will display
.Column1.ControlSource = 'MyAlias.Field1'
.Column2.ControlSource = 'MyAlias.Field2'
........
.Column10.ControlSource = 'MyAlias.Field10'

&& define column widths
.Column1.Width = 100
.Column2.Width = 50
.......

&& define column header captions
.Column1.Header1.Caption = 'Field1Caption'
.Column2.Header1.Caption = 'Field2Caption'
.......

&& Sample of how to add custom object into column
.Column2.AddObject('Combo1','MyCombobBoxClass')
.Column2.Combo1.Visible = .T.
.Column2.CurrentControl = 'Combo1'
&& remove original (default) control
.Column2.Text1.Visible = .F.
.Column2.RemoveObject('Text1')
&& define properties of combobox in column
with .Column2.Combo1
.ColumnCount = 2
.ColumnWidths = 30,50
.......
endwith

&& Don't forget to show grid ;)
.Visible = .T.
endwith



Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Perfect Vlad.... You type faster then me. You might consider putting that in an FAQ too.
-Pete
 
Hallo Vlad

Iwas catch you code program

Thank's Vlad

 
Ok, its now in the FAQ. Look to it, I improved this code to be more generic and added some additional tricks.

Vlad Grynchyshyn
vgryn@softserve.lviv.ua
The professional level of programmer could be determined by level of stupidity of his/her bugs
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top