Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview Problem
Message
De
08/02/2008 04:04:09
 
 
À
07/02/2008 10:08:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01290371
Message ID:
01290747
Vues:
17
If this code is in the Form.Activate() you need to take steps to ensure that is only runs once - otherwise it will attempt to add the nodes to the tree again.


>Form1's activate event has following codes
>
>CREATE cursor mytable (accno n(6), node N(6),child N(6),name c(30))
>APPEND from dbf('pay')
>
>SELECT mytable
>REPLACE all child with val(substr(alltrim(str(accno)),3,2))
>REPLACE all node with val(substr(alltrim(str(accno)),1,2))
>REPLACE all child with 0 for(substr(alltrim(str(accno)),3,2))="00"
>
>SELECT ;
>	'_'+Padl(Node,5,'0')+Padl(Child,5,'0') As NodeId,;
>	Iif(Child=0,space(11),'_'+Padl(Node,5,'0')+Padl(0,5,'0')) As ParentID,;
>	name As NodeText,TRIM(STR(accno)) as code  ;
>	from mytable ;
>	order By 1 ;
>	into Cursor myTree
>
>SELECT myTree
>#DEFINE tvwFirst	0
>#DEFINE tvwLast		1
>#DEFINE tvwNext		2
>#DEFINE tvwPrevious	3
>#DEFINE tvwChild	4
>
>WITH Thisform.OleTreeView.Nodes
>	SCAN
>		IF Empty(ParentID)
>			oNode = .Add(,tvwFirst,NodeId,code+ ' '+Trim(NodeText))
>			oNode.ForeColor = RGB(0,0,0)
>		ELSE
>			oNode = .Add(ParentID,tvwChild,NodeId,code +' '+Trim(NodeText))
>			oNode.ForeColor = RGB(0,0,255)
>		ENDIF
>	ENDSCAN
>ENDWITH
>
>
>This work fine but when I issue this command
>
>report form card1 TO PRINTER PROMPT NOCONSOLE
>
>then this error message appears
>OLE IDispatch exception code 0 from Nodes: key is not unique in collection
>
>and debugg window show this line
>oNode = .Add(ParentID,tvwChild,NodeId,code +' '+Trim(NodeText))
>
>What is wrong with my codes?
>
>Please help
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform