ARRAY -- ESTOY BLOQUEADO..

HMG en Español

Moderator: Rathinagiri

User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

Bonjour,
comment mettre des fichiers (file1.dbf ,...,files.dbf) qui sont dans un repertoire(c:\directory\*.dbf)) dans listbox et ouvrir une des tables.
merci d'avance
Hello,
how to put files (file1.dbf ,...,files.dbf) which are in a directory (c:\directory\*.dbf) in listbox and open one of the tables.
thank you in advance
L'Algerie vous salut
Y.TABET
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by SALINETAS24 »

tonton2 wrote: Wed Jan 11, 2023 11:05 am Bonjour,
comment mettre des fichiers (file1.dbf ,...,files.dbf) qui sont dans un repertoire(c:\directory\*.dbf)) dans listbox et ouvrir une des tables.
merci d'avance
Hello,
how to put files (file1.dbf ,...,files.dbf) which are in a directory (c:\directory\*.dbf) in listbox and open one of the tables.
thank you in advance
Hola Tonton2, aqui tienes un ejemplo de lo que quieres. Espero que te sirva.
Attachments
LISTBOX_2.rar
(1.21 MiB) Downloaded 80 times
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

Merci mon ami
L'Algerie vous salut
Y.TABET
User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

Bonjour,
En voulant ouvrir cFile := (BL_Produit.dbf) ,le message suivant apparait, avez une idée pour résoudre ce problème
Bonsoir,
Hello,
When wanting to open cFile:= (BL_Produit.dbf), the following message appears, do you have an idea to solve this problem
Attachments
Listbox.rar
(1.21 MiB) Downloaded 69 times
Capture.JPG
Capture.JPG (33.52 KiB) Viewed 992 times
L'Algerie vous salut
Y.TABET
User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

SALINETAS24 wrote: Wed Jan 11, 2023 1:33 pm
tonton2 wrote: Wed Jan 11, 2023 11:05 am Bonjour,
comment mettre des fichiers (file1.dbf ,...,files.dbf) qui sont dans un repertoire(c:\directory\*.dbf)) dans listbox et ouvrir une des tables.
merci d'avance
Hello,
how to put files (file1.dbf ,...,files.dbf) which are in a directory (c:\directory\*.dbf) in listbox and open one of the tables.
thank you in advance
Hola Tonton2, aqui tienes un ejemplo de lo que quieres. Espero que te sirva.
Bonjour,
Avez vous une idée comment contourner ce probleme
merci.
Do you have any idea how to get around this problem?
thank you
¿Tienes alguna idea de cómo solucionar este problema?
Gracias
L'Algerie vous salut
Y.TABET
User avatar
gfilatov
Posts: 1090
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by gfilatov »

tonton2 wrote: Thu Jan 12, 2023 11:11 am
SALINETAS24 wrote: Wed Jan 11, 2023 1:33 pm
tonton2 wrote: Wed Jan 11, 2023 11:05 am Bonjour,
comment mettre des fichiers (file1.dbf ,...,files.dbf) qui sont dans un repertoire(c:\directory\*.dbf)) dans listbox et ouvrir une des tables.
merci d'avance
Hello,
how to put files (file1.dbf ,...,files.dbf) which are in a directory (c:\directory\*.dbf) in listbox and open one of the tables.
thank you in advance
Hola Tonton2, aqui tienes un ejemplo de lo que quieres. Espero que te sirva.
Bonjour,
Avez vous une idée comment contourner ce probleme
merci.
Do you have any idea how to get around this problem?
thank you
¿Tienes alguna idea de cómo solucionar este problema?
Gracias
Hello,

Please try the updated example below. :arrow:

Code: Select all

/*
* Ejemplo para Listbox + Directory para TONTON2
* Salineta24 - Petrer City (Alicante - SPAIN)
* Email : SARGANTANTASOFT@GMAIL.COM
*/

#include "hmg.ch"

FUNCTION  Main
LOCAL nFor, cCarpeta
LOCAL aNombreFiles:={}   // Solo se usa para la definicion del listbox


	
	DEFINE WINDOW Win1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 400 ;
		TITLE 'CARGAR FICHERO DBF' ;
		MAIN 
		
	    DEFINE MAIN MENU
			DEFINE POPUP "File"
				MENUITEM "Cargar DBF" ACTION  cCarpeta:=CargarDbf()
				SEPARATOR
				MENUITEM "Salir" ACTION ThisWIndow.Release 
			END POPUP
		END MENU
		
		@ 10,10 LISTBOX LIST1 ;
			WIDTH 100 HEIGHT 200 ;
			ITEMS aNombreFiles ;
			ON DBLCLICK EjecutaDBF(cCarpeta)
			

	END WINDOW

	Win1.Center
	ACTIVATE WINDOW Win1 
RETURN

FUNC CargarDBF
LOCAL nFor, cCarperta
LOCAL aTotalFiles:={}
	// Carga Directorio
	cCarpeta:=GetFolder("Directorio DBFґs")
	aTotalFiles:=Directory(cCarpeta+"\*.DBF")
	// Borro todo el Listbox
	DoMethod ( "Win1", "List1", 'DeleteAllItems' )
	FOR nFor=1 To LEN(aTotalFiles)
		DoMethod ( "Win1", "List1", 'AddItem', aTotalFiles[nFor][1] )
	NEXT
RETURN cCarpeta

PROC EjecutaDBF(cCarpeta)
LOCAL cFile
LOCAL nPos
	nPos:=Win1.List1.Value
	IF nPos=0
		MSGBOX("Error en seleccion")
	ELSE
		cFile:=Win1.List1.item(nPos)
		msgbox("FICHERO "+cCarpeta+"\"+cFile)
	
	     	use (cCarpeta+"\"+cFile)  // Ajout
		COPY STRUCTURE TO Gest_ant  FIELDS REFERENCE,PRIX_TOTAL,QUANTITE0
	
             Use Gest_Ant
             APPEND FROM (cCarpeta+"\"+cFile) FIELDS REFERENCE,PRIX_TOTAL,QUANTITE0
		EDIT EXTENDED
	ENDIF 
RETURN
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

gfilatov wrote: Thu Jan 12, 2023 1:54 pm
tonton2 wrote: Thu Jan 12, 2023 11:11 am
SALINETAS24 wrote: Wed Jan 11, 2023 1:33 pm

Hola Tonton2, aqui tienes un ejemplo de lo que quieres. Espero que te sirva.
Bonjour,
Avez vous une idée comment contourner ce probleme
merci.
Do you have any idea how to get around this problem?
thank you
¿Tienes alguna idea de cómo solucionar este problema?
Gracias
Hello,

Please try the updated example below. :arrow:

Code: Select all

/*
* Ejemplo para Listbox + Directory para TONTON2
* Salineta24 - Petrer City (Alicante - SPAIN)
* Email : SARGANTANTASOFT@GMAIL.COM
*/

#include "hmg.ch"

FUNCTION  Main
LOCAL nFor, cCarpeta
LOCAL aNombreFiles:={}   // Solo se usa para la definicion del listbox


	
	DEFINE WINDOW Win1 ;
		AT 0,0 ;
		WIDTH 400 ;
		HEIGHT 400 ;
		TITLE 'CARGAR FICHERO DBF' ;
		MAIN 
		
	    DEFINE MAIN MENU
			DEFINE POPUP "File"
				MENUITEM "Cargar DBF" ACTION  cCarpeta:=CargarDbf()
				SEPARATOR
				MENUITEM "Salir" ACTION ThisWIndow.Release 
			END POPUP
		END MENU
		
		@ 10,10 LISTBOX LIST1 ;
			WIDTH 100 HEIGHT 200 ;
			ITEMS aNombreFiles ;
			ON DBLCLICK EjecutaDBF(cCarpeta)
			

	END WINDOW

	Win1.Center
	ACTIVATE WINDOW Win1 
RETURN

FUNC CargarDBF
LOCAL nFor, cCarperta
LOCAL aTotalFiles:={}
	// Carga Directorio
	cCarpeta:=GetFolder("Directorio DBFґs")
	aTotalFiles:=Directory(cCarpeta+"\*.DBF")
	// Borro todo el Listbox
	DoMethod ( "Win1", "List1", 'DeleteAllItems' )
	FOR nFor=1 To LEN(aTotalFiles)
		DoMethod ( "Win1", "List1", 'AddItem', aTotalFiles[nFor][1] )
	NEXT
RETURN cCarpeta

PROC EjecutaDBF(cCarpeta)
LOCAL cFile
LOCAL nPos
	nPos:=Win1.List1.Value
	IF nPos=0
		MSGBOX("Error en seleccion")
	ELSE
		cFile:=Win1.List1.item(nPos)
		msgbox("FICHERO "+cCarpeta+"\"+cFile)
	
	     	use (cCarpeta+"\"+cFile)  // Ajout
		COPY STRUCTURE TO Gest_ant  FIELDS REFERENCE,PRIX_TOTAL,QUANTITE0
	
             Use Gest_Ant
             APPEND FROM (cCarpeta+"\"+cFile) FIELDS REFERENCE,PRIX_TOTAL,QUANTITE0
		EDIT EXTENDED
	ENDIF 
RETURN
Thank you very much. I'll test your sample and btw I found a solution. I'll soon send you mine
L'Algerie vous salut
Y.TABET
User avatar
tonton2
Posts: 455
Joined: Sat Jun 29, 2013 1:26 pm
Location: Algerie
Contact:

Re: ARRAY -- ESTOY BLOQUEADO..

Post by tonton2 »

RE ,
Voila finalement une partie du programme solutionné
Here is finally a part of the solved program
Aquí está finalmente una parte del programa resuelto.
Merci a tous pour votre Aide
Attachments
CAIS_WINRAR.rar
(1.21 MiB) Downloaded 98 times
L'Algerie vous salut
Y.TABET
Post Reply