Er enig med AC/F2, det er mest praktisk at skrive til en fil.
Du kan skrive til en ini fil på denne måde.
Put følgende kode ind i et modul eller i toppen af din form:
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private 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
Private Sub WriteSetting(File As String, Section As String, KeyName As String, Value As String)
WritePrivateProfileString Section, KeyName, Value, File
End Sub
Private Function ReadSetting(File As String, Section As String, KeyName As String)
Dim Ret As String, NC As Long
Ret = String(255, 0)
NC = GetPrivateProfileString(Section, KeyName, "Default", Ret, 255, File)
If NC <> 0 Then Ret = Left$(Ret, NC)
If Ret = "Default" Then
Ret = ""
End If
ReadSetting = Ret
End Function
Du kan læse fra .ini filen med denne command:
ReadSetting(filnavn, sektion, keyname)
og skrive med denne:
WriteSetting filnavn, sektion, keyname, keyvalue
Håber du ka bruge det.
gl & hf
[Redigeret d. 06/02-04 22:01:42 af Mikkel Schmidt]