rt,谢谢!

解决方案 »

  1.   

    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 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
    Dim rtnValueA As VariantFunction WriteToIni(ByVal strFileName As String, ByVal strSectionName _
    As String, ByVal strKeyName As String, ByVal strValue As String)
    '将值写到INI文件中去
    rtnValueA = WritePrivateProfileString(strSectionName, strKeyName, strValue, strFileName)
    End Function
    Function ReadFromIni(ByVal strFileName As String, ByVal strSectionName _
    As String, ByVal strKeyName As String, ByVal strDefault As String)
    Dim strOut As String * 255
    '从INI文件中读取值
    rtnValueA = GetPrivateProfileString(strSectionName, strKeyName, strDefault, strOut, 255, strFileName)
    ReadFromIni = Trim(Replace(strOut, Chr(0), ""))
    End Function
    '---------------------------------------------------------------------------------
    以上的两个函数,你自己用吧!
    很简单的调用。
      

  2.   

    每在ini中读一条记录就在listview中ListView_list.Items.Add;每读一个字段就在相应的listview记录上jiluji.Fields.Add;当然如果你已经规定了有几个字段,那就不用jiluji.Fields.Add了,只需jiluji.Fields[j].AsString就可以了。
      

  3.   

    在listview中的格式字段1  字段2  字段3
    A       a      1
    B       b      2
    C       c      3
      

  4.   

    你先定一下INI文件中的键值命名规则。
    比如:
    [User]
    UserName1=abc
    Password1=abc
    UserName2=cde
    Password2=cde把USER作为一个表
    把UserName Password作为字段
    1 2 作为第N条记录在程序中操作数组一样操作不就好了?
    读取INI用我给你的函数。
    一点一点添加到LISTVIEW中。