Visual Basic - leer y mostrar texto fichero ini

Life is soft - evento anual de software empresarial
 
Vista:

leer y mostrar texto fichero ini

Publicado por jlcastro (114 intervenciones) el 29/04/2001 01:25:09
como puedo leer un fichero llamado softde.ini
el cual contiene esta numeracion 535378 y mostrarlo en un text o en una etiqueta label.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:leer y mostrar texto fichero ini

Publicado por rela (40 intervenciones) el 29/04/2001 23:05:38
prueba con esto...

en un modulo:

Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long

Public Function ReadINI(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let ReadINI$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function

Public Sub WriteINI(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub

y en un formulario:

para leer..

variable = ReadINI(CLAVE, SUBCLAVE, "C:\a.ini")

CLAVE y SUBCLAVE = especifica el texto que quieres del archivo ini.

Para escribir...

Call WriteINI "CLAVE", "SUBCLAVE", "VALOR","C:\a.ini")

espero que te sirva...
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar