Results 1 to 2 of 2

Thread: Value Problem!!! Help!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Lindenwold, NJ, USA
    Posts
    67
    I put this in my code:

    In General Declaration:
    Code:
    Dim eee As String
    Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As Any, ByVal lsString As Any, ByVal lplFilename As String) As Long
    Public Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
    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
    Sub connected to my Form Load sub
    Code:
    Public Sub Load()
    X = 1
    rrr = GetPrivateProfileString("BigMoney", "Value", 0, Temp, Len(Temp), "BigMoney.ini")
    For X = 1 To Temp
    rrr = GetPrivateProfileString(X, "Name", 0, Temp2, Len(Temp2), "BigMoney.ini")
    rrr = GetPrivateProfileString(X, "Score", 0, Temp3, Len(Temp3), "BigMoney.ini")
    List1.AddItem (Temp2 & " - " & Temp3)
    Next X
    End Sub
    It Returns Just the Temp2 Value in the List Box. And if I put Temp3 First it just returns the Temp3 value in the list box. What I am saying is it wont let anything go after it.
    HELp
    Frankie Weindel
    VB 6 Learning Edtion SP3

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb

    you need to set the buffer value for the return string.

    Code:
    Option Explicit
    Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationname As String, ByVal lpKeyName As Any, ByVal lsString As Any, ByVal lplFilename As String) As Long
    Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPriviteProfileIntA" (ByVal lpApplicationname As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal lpFileName As String) As Long
    Private 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
    
    Private Sub Form_Load()
    Dim rrr As String
    Dim xxx As Long
    Dim Temp1$, Temp2$, Temp%
    
    rrr = String(255, Chr(0))
    xxx = GetPrivateProfileString("BigMoney", "Value", 0, rrr, Len(rrr), "BigMoney.ini")
    If xxx <> 0 Then
        Temp1 = Left(rrr, InStr(1, rrr, Chr(0), vbTextCompare) - 1)
    End If
    
    For X = 1 To Temp
        rrr = String(255, Chr(0))
        xxx = GetPrivateProfileString(X, "Name", 0, rrr, Len(rrr), "BigMoney.ini")
        If xxx <> 0 Then
            Temp1 = Left(rrr, InStr(1, rrr, Chr(0), vbTextCompare) - 1)
        End If
        rrr = String(255, Chr(0))
        xxx = GetPrivateProfileString(X, "Score", 0, rrr, Len(rrr), "BigMoney.ini")
        If xxx <> 0 Then
            Temp2 = Left(rrr, InStr(1, rrr, Chr(0), vbTextCompare) - 1)
        End If
        List1.AddItem (Temp2 & " - " & Temp3)
    Next X
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width