Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Firing multiple select query to store all the values to
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00780348
Message ID:
00780720
Vues:
14
Maybe this will help clarify somethings. Run this and let me know if this is what you wanted to do.
PUBLIC oFrm
oFrm = CREATEOBJECT("frmListBoxes")
oFrm.Show()


DEFINE CLASS frmListBoxes as Form

Caption           = "List Box Test"
Width             = 610
Height            = 182
BorderStyle       = 2
MinButton         = .F.
MaxButton         = .F.

ADD OBJECT List1 as ListBox
List1.Left        = 6
List1.Top         = 6
List1.Visible     = .T.
List1.Width       = 200
List1.Height      = 170
List1.ColumnCount = 2
List1.MultiSelect = .T.

ADD OBJECT List2 as ListBox
List2.Left        = 304
List2.Top         = 6
List2.Visible     = .T.
List2.Width       = 300
List2.Height      = 170
List2.ColumnCount = 3

ADD OBJECT Command1 As cCommand
Command1.Left     = 214
Command1.Top      = 6
Command1.Visible  = .T.
Command1.Width    = 84
Command1.Height   = 24
Command1.Caption  = "Fill List"

PROCEDURE INIT
CREATE CURSOR Sub (project_no C(3), workpkg_no C(5),sub_title C(150),to_cont c(10))
FOR n = 1 TO 20
INSERT INTO Sub VALUES ("AAA","AAAAA","Sub Title " + TRANSFORM(n),"")
INSERT INTO Sub VALUES ("BBB","BBBBB","Sub Title " + TRANSFORM(n),"")
ENDFOR 
This.List1.AddListItem("AAA"  ,1,1)
This.List1.AddListItem("AAAAA",1,2)
This.List1.AddListItem("BBB"  ,2,1)
This.List1.AddListItem("BBBBB",2,2)
ENDPROC

PROCEDURE DESTROY
USE IN SELECT("Sub")
USE IN SELECT("cuList2")
ENDDEFINE

DEFINE CLASS cCommand AS CommandButton 

PROCEDURE CLICK
* Original code from POST
CREATE CURSOR cuList2 (project_no C(3), workpkg_no C(5),sub_title C(150))
for n = 1 to thisform.list1.listcount
 
IF thisform.list1.Selected(n) &&This line added to posted code

col1 = thisform.list1.listitem(n, 1)
col2 = thisform.list1.listitem(n,2)
select project_no,workpkg_no,sub_title from sub where project_no = col1 and workpkg_no = col2 and empty(to_cont) into cursor temp
select cuList2
append from dbf("temp")
use in select("temp")

endif &&This line added to posted code

endfor


WITH thisform.list2
.RowSourceType = 2 && Alias
.RowSource = "cuList2"
.Requery()
.refresh()
.setfocus()
ENDWITH
* END original code from POST
ENDPROC

ENDDEFINE
Tracy
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform