CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Threaded View

  1. #1
    Join Date
    Jun 2002
    Location
    Amsterdam
    Posts
    6

    Question Read INI file with GetPrivateProfileString

    Hello,

    I'm trying to read an ini file with the API Call GetPrivateProfileString. The code below works in VB6, but not in VB.NET. Does anybody know why. Please let me know if u do!


    Code:
    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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    
            Dim strRetString As String
            strRetString = "          "
            Dim lngRetval As Long
            lngRetval = GetPrivateProfileString("SECTIONNAME", "KEYNAME", "Default Value", strRetString, Len(strRetString), "C:\AnIniFile.ini")
    
    End Sub
    Last edited by JohnDigweed; July 26th, 2002 at 09:11 AM.
    Regards,

    John Digweed

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

Featured