in the .ini file thats made it adds an = ,to the end.
i can change everything to suit me,but removing the = sign.
thanks
Code:Private Sub Form_Load() Call ReadScores End Sub Private Sub Form_Unload(Cancel As Integer) Call SaveScores End SubCode:Option Explicit ' 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 Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As Any, ByVal lpFileName As String) As Long ' ' <<< Public Declarations >>> ' Public g_tbl_Scores() As String 'table to hold scores ' ' <<< Local Constants >>> ' Const m_int_SCORES As Integer = 0 'number of scores to track ' ' ' <<< Public Functions >>> ' Public Function ReadINI(Section, KeyName, FileName As String) As String Dim sRet As String sRet = String(255, Chr(0)) ReadINI = Left(sRet, GetPrivateProfileString(Section, ByVal KeyName, "", sRet, Len(sRet), FileName)) End Function ' Public Function writeini(sSection As String, sKeyName As String, sNewString As String, sFileName) As Integer Dim variable 'doesn't seem to matter variable = WritePrivateProfileString(sSection, sKeyName, sNewString, sFileName) End Function ' Public Function NormPath(sPath As String, Optional sSeperator As String = "\") As String If Right(sPath, Len(sSeperator)) = sSeperator Then NormPath = sPath Else NormPath = sPath & sSeperator End If End Function ' Public Sub ReadScores() 'this sub will load the scores from an ini file into 'an array Dim sFile As String Dim iControl As Integer sFile = NormPath(App.Path) & "HighScores.ini" ' ReDim g_tbl_Scores(m_int_SCORES) 'resize array ' For iControl = 0 To m_int_SCORES g_tbl_Scores(iControl) = ReadINI("HighScore", _ "Score.", sFile) Next iControl End Sub ' Public Sub SaveScores() 'this sub will save scores from an array Dim sFile As String Dim iControl As Integer sFile = NormPath(App.Path) & "HighScores.ini" ' For iControl = 0 To m_int_SCORES writeini "HighScore", "Score.", _ g_tbl_Scores(iControl), sFile Next iControl End Sub




Reply With Quote