>01 DEFINE CLASS ClassOpenCmdButton AS CommandButton
>02 FUNCTION Click
>03 FileName=GETFILE("DBF","Phone Book","Open",0)
>04 IF !EMPTY(FileName)
>05 CLOSE DATABASE
>06 USE &FileName
>07 DO WHILE !EOF()
>08 AddIndex=THISFORM.ObjListBoxSource.NewItemId+1
>09 THISFORM.ObjListBoxSource.AddListItem(TO,AddIndex,1)
>10 THISFORM.ObjListBoxSource.AddListItem(ATTN,AddIndex,2)
>11 THISFORM.ObjListBoxSource.AddListItem(FAXNO,AddIndex,3)
>12 SKIP
>13 ENDDO
>14 CLOSE DATABASE
>15 THISFORM.ObjListBoxSource.Requery
>16 ENDIF
>17 RETURN
>18 ENDDEFINE
>
>
>19 DEFINE CLASS ClassListBoxSource AS ListBox
>20 ColumnCount=3
>21 ColumnLines=.F.
>22 ColumnWidths="280,200,200"
>23 RowSourceType=0
>24 Sorted=.T.
>25
>26 FUNCTION DblClick
>27 RemoveIndex=THIS.ListIndex
>28 AddIndex=THISFORM.ObjListBoxTarget.NewItemId+1
>29 THISFORM.ObjListBoxTarget.AddListItem(THIS.List(RemoveIndex,1),AddIndex,1)
>30 THISFORM.ObjListBoxTarget.AddListItem(THIS.List(RemoveIndex,2),AddIndex,2)
>31 THISFORM.ObjListBoxTarget.AddListItem(THIS.List(RemoveIndex,3),AddIndex,3)
>32 THIS.RemoveItem(RemoveIndex)
>33 RETURN
>34 ENDDEFINE
>
>
>Hi!
>
>In the line 07 - 13, Can I using SQL-SELECT? If yes, how change it?
>
>Thank you!
Yes, by macro substitution.
SELECT your_desired_fields_here FROM &filename INTO CURSOR myfile.
Thisform.ObjListBox.RecordSource = "myfile"
Thisform.ObjListBox.Requery()
Your recordsourcetype should be alias or fields.
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net
CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."