Publi yform yform=Createobject("asup") yform.Show Read Events Retu * Define Class asup As Form Height = 278 Width = 771 AutoCenter = .T. Caption = "vfp listbox control demo" MaxButton = .F. BackColor = Rgb(212,208,200) ycount = "0" Name = "Form1" Add Object list1 As ListBox With ; ColumnCount = 4, ; ColumnWidths = "30,70,70,70", ; RowSourceType = 6, ; RowSource = "ycurs.cust_id,company,contact,address", ; Height = 205, ; Left = 13, ; Top = 16, ; Width = 743, ; Name = "List1" Add Object command1 As CommandButton With ; Top = 228, ; Left = 314, ; Height = 37, ; Width = 166, ; FontBold = .T., ; WordWrap = .T., ; Caption = "Runtime-Click me many times", ; MousePointer = 15, ; ForeColor = Rgb(255,0,0), ; Name = "Command1" Add Object check1 As Checkbox With ; Top = 240, ; Left = 60, ; Height = 17, ; Width = 93, ; AutoSize = .T., ; Alignment = 0, ; BackStyle = 0, ; Caption = "ColumnLines", ; Value = .T., ; Name = "Check1" Procedure Init With This .ycount=0 .command1.Click Endwith Endproc Procedure Load Sele * From Home(1)+"samples\data\customer" Into Cursor ycurs *brow *choosen 4 fields from cursor to demo Endproc Procedure Destroy Clea Events Endproc Procedure command1.Click * columnwidths listbox property is available at design time and run time. With Thisform .ycount=.ycount+1 Do Case Case .ycount=1 m.x="100,100,100,100" Case .ycount=2 m.x="60,120,150,140" Case .ycount=3 m.x="120,90,100,120" Case .ycount=4 m.x="110,103,100,90" .ycount=0 Endcase .list1.ColumnWidths=m.x Endwith Endproc Procedure check1.Click Thisform.list1.ColumnLines=!Thisform.list1.ColumnLines Endproc Enddefine * *-- EndDefine: asup